.top-menu .layout-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 8px;
    color: #184481;
    background: #e3edfc;
    border: 1px solid #b0c7e7;
    font: 700 12px Tahoma,sans-serif;
    text-decoration: none;
    white-space: nowrap;
}
.top-menu .layout-menu-link:hover, .top-menu .layout-menu-link:focus-visible { background: #cfe3ff; }
.transfer-card { max-width: calc(100vw - 20px); width: 440px; }
.transfer-card label { display: grid; gap: 5px; }
.transfer-card select { width: 100%; min-height: 38px; }
.transfer-card p { margin-bottom: 0; color: #435677; }
.touch-action { display: none !important; }
.io-channel:not(:disabled), .mini-channel:not(:disabled), .value-switch:not(:disabled) { touch-action: none; }
#rungs .unified-circuit .element-address { pointer-events: auto; }
#rungs .unified-circuit button.element-address { border: 0; padding: 0; box-shadow: none; cursor: pointer; }
#rungs .unified-circuit .variable-picker { pointer-events: auto; }
.plc-dialog .io-channel { overflow: hidden; }
.plc-dialog .io-channel b { overflow-wrap: anywhere; }
.plc-dialog { max-width: calc(100vw - 12px); max-height: calc(var(--forge-visible-height,100vh) - 14px); overflow: auto; }
.plc-zoom { touch-action: pan-y; }
dialog.modal[open] { max-height: calc(var(--forge-visible-height,100vh) - 16px); overscroll-behavior:contain; }
body.forge-keyboard dialog.modal[open] {
    position:fixed; top:calc(var(--forge-visible-top,0px) + 8px); bottom:auto; margin-block:0;
}
#blockDialog[open] .block-modal-card { max-height:calc(var(--forge-visible-height,100vh) - 20px); }
#guideDialog { width:min(576px,calc(100vw - 24px)); }
#guideDialog > header { flex-shrink:0; gap:9px; }
#guideDialog > header button { flex:none; width:44px; height:44px; touch-action:manipulation; }
#guideDialog .forge-window-body { flex:1 1 auto; min-height:0; -webkit-overflow-scrolling:touch; }
#guideContent { min-height:0; }
#guideContent h3 { margin:0 0 9px; font-size:17px; }
#guideContent p { margin:0; }
#guideDialog > footer { flex-wrap:wrap; padding:10px 16px; }
#guideDialog > footer button { min-height:44px; white-space:nowrap; touch-action:manipulation; }
#guideDialog .guide-secondary, #guideDialog .guide-navigation { align-items:center; }
#guideDialog .guide-navigation { margin-left:auto; }
#guideProgress { flex:none; font:600 12px system-ui,sans-serif; color:#4b6182; }
.forge-touch-tablet .touch-action { display:inline-flex !important; }
.forge-touch-tablet .instruction-palette { -webkit-overflow-scrolling:touch; }
.forge-touch-tablet :is(.variable-picker,#newVarName,#newVarAddress) { font-size:16px; }
#rungs.touch-panning { touch-action:none; }
#touchPanLadder[aria-pressed="true"] { background:#dceaff; border-color:#5990d0; }
.forge-touch-tablet #rungs { padding-bottom: max(100px, 16dvh) !important; }
.forge-touch-tablet :is(.forge-window,.vrmd-save-dialog) { max-height: 88dvh; overflow:auto; }
@media (any-pointer: coarse) {
    .app-shell { grid-template-rows: 99px minmax(0,1fr) 24px; }
    .topbar { height: 99px; grid-template-rows: 20px 38px 41px; }
    .top-menu .app-menu > button, .top-menu .layout-menu-link { height: 36px; }
    .top-menu .menu-popover { top: 36px; }
    .menu-popover button, .app-context-menu button { min-height: 40px; }
    .operand-suggestions button { min-height:40px; touch-action:pan-y; }
    .classic-toolbar button, .classic-toolbar .transfer-tool { height: 38px; min-width: 38px; }
    .top-actions { overflow-x: auto; }
    .tree-row, .tree-static, .device-tree summary, .device-links button { min-height: 34px; }
    .mini-channel { min-height: 34px; }
    .mini-plc :is(header,footer) button { min-height: 38px; }
    .modal :is(button,input,select), .plc-dialog button, .tag-tools :is(button,input,select) { min-height: 40px; }
    .modal input:not([type="checkbox"]), .modal select { font-size: 16px; }
    .touch-action { display: inline-flex !important; }
    .workbench-actions button, .ladder-quickbar button, .instruction-group button, .instruction-group summary { min-height: 36px; }
    .workbench-actions { flex-wrap: wrap; }
    #touchMove[aria-pressed="true"] { background: #dceaff; border-color: #5990d0; }
    #rungs .unified-circuit .wire-hit { stroke-width: 23px; }
    #rungs .unified-circuit .glyph-hit { touch-action: none; }
    #rungs .unified-circuit :is(.element-address,.variable-label,.pin-value) { touch-action: manipulation; }
    #rungs .unified-circuit button.element-address { min-height: 20px; }
    body.cpu-running #rungs :is(.contact-element .glyph-hit,.contact-element .element-address,.contact-element .variable-label) { touch-action: none; }
    .tag-table-view button, .tag-table-wrap :is(button, select) { min-height: 38px; }
    .block-modal-card { max-height: calc(100dvh - 16px); overflow: auto; }
}
@media (max-height:520px) {
    #guideDialog > header { padding:8px 13px; }
    #guideDialog > header small { display:none; }
    #guideDialog h2 { font-size:17px; }
    #guideDialog .forge-window-body { padding:9px 13px; }
    #guideDialog > footer { padding:6px 11px; }
}
@media (max-width: 720px) {
    .app-shell { grid-template-rows: auto minmax(0,1fr) auto; }
    .topbar { min-height: 0; height: auto; grid-template-rows: 20px auto auto; }
    .top-menu { flex-wrap: wrap; min-height: 0; padding: 1px 3px; }
    .top-menu .app-menu > button { padding-inline: 7px !important; }
    .top-actions { position: relative; padding-right: 47px; min-height: 35px; }
    .top-menu .site-menu-link { display: none; }
    .plc-dialog .plc-face { display: grid; grid-template-columns: minmax(0,1fr); }
    .plc-dialog .plc-face section { min-height: 0; }
    .plc-dialog .cpu-center { grid-row: 1; }
    .plc-dialog .io-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .plc-dialog .plc-console>footer { flex-wrap: wrap; }
    .transfer-card { box-sizing: border-box; width: min(440px, calc(100vw - 22px)); }
}
