* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 13px/1.3 "Segoe UI", Tahoma, Arial, sans-serif; color: #1d1d1d; background: #d4d0c8; -webkit-user-select: none; user-select: none; }
.hidden { display: none !important; }
#app { display: flex; flex-direction: column; height: 100%; }
#titlebar { background: linear-gradient(#fdfdfd, #e9eef6); border-bottom: 1px solid #a9b4c4; padding: 3px 8px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
#titlebar .logo { color: #2a62b8; font-weight: bold; }
#titlebar .ver { margin-left: auto; color: #8a8a8a; }
#menubar { background: #f6f6f6; border-bottom: 1px solid #c8c8c8; display: flex; position: relative; z-index: 30; }
.mtop { padding: 4px 10px; cursor: default; position: relative; }
.mtop:hover, .mtop.open { background: #cfe0f7; }
.mdrop { position: absolute; left: 0; top: 100%; background: #fff; border: 1px solid #9a9a9a; box-shadow: 2px 3px 8px rgba(0,0,0,.25); min-width: 230px; padding: 3px 0; display: none; }
.mtop.open > .mdrop { display: block; }
.mi { padding: 5px 24px 5px 26px; white-space: nowrap; position: relative; }
.mi:hover { background: #cfe0f7; }
.mi.dis { color: #a0a0a0; }
.mi .key { position: absolute; right: 10px; color: #777; }
.mi.sub::after { content: '›'; position: absolute; right: 10px; }
.mi > .mdrop { left: 100%; top: -4px; }
.mi:hover > .mdrop { display: block; }
.msep { border-top: 1px solid #ddd; margin: 3px 0; }
#main { flex: 1; display: flex; min-height: 0; }
#left { width: 268px; min-width: 268px; background: #f2f1ee; border-right: 1px solid #a7a7a7; display: flex; flex-direction: column; }
#left.collapsed { display: none; }
#leftBody { flex: 1; overflow-y: auto; overflow-x: hidden; }
#tabs { display: flex; border-top: 1px solid #a7a7a7; background: #e4e2dc; }
#tabs button { flex: 1; border: 0; border-right: 1px solid #bdbdbd; background: transparent; padding: 5px 0; font: inherit; cursor: pointer; }
#tabs button.on { background: #fff; font-weight: 600; }
.sec { border-bottom: 1px solid #d2d0ca; }
.sech { background: linear-gradient(#e8e7e3, #d9d8d3); padding: 3px 8px; font-weight: 600; display: flex; justify-content: space-between; cursor: pointer; font-size: 12.5px; }
.sech::after { content: '▲'; font-size: 9px; border: 1px solid #888; padding: 0 3px; background: #f4f4f4; }
.sec.closed .sech::after { content: '▼'; }
.sec.closed .secb { display: none; }
.secb { padding: 6px 6px 8px; }
.icons { display: flex; flex-wrap: wrap; gap: 3px; }
.ib { width: 40px; height: 36px; border: 1px solid transparent; border-radius: 3px; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; padding: 0; }
.ib:hover { border-color: #9db4d6; background: #e7effb; }
.ib.on { border-color: #557dbb; background: #cfdcf2; }
.ib.dis { opacity: .35; pointer-events: none; }
.ib svg { width: 28px; height: 28px; }
.ib .fly { position: absolute; right: 0; bottom: 0; font-size: 9px; color: #333; width: 9px; height: 12px; line-height: 12px; }
.flyout { position: fixed; z-index: 60; background: #f8f8f6; border: 1px solid #8f8f8f; box-shadow: 2px 3px 8px rgba(0,0,0,.3); display: flex; padding: 3px; gap: 2px; }
.tip { position: fixed; z-index: 70; background: #ffffe1; border: 1px solid #777; padding: 3px 6px; font-size: 12px; pointer-events: none; max-width: 260px; }
.info { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; font-size: 12px; }
.info b { display: block; }
.page { padding: 0 0 10px; }
.pageh { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #ccc; background: #fff; }
.pageh .pi svg { width: 30px; height: 30px; }
.pageh h2 { margin: 0; font-size: 18px; color: #253f73; }
.grp { margin: 8px 8px 0; border: 1px solid #c9c7c0; background: #fbfbfa; }
.grp > .gt { background: #dcdad4; padding: 2px 6px; font-weight: 600; font-size: 12px; }
.grp > .gb { padding: 6px; }
.row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.row label { flex: 1; }
.row input[type=number], .row input[type=text], .row select { width: 96px; font: inherit; padding: 2px 4px; border: 1px solid #9a9a9a; background: #fff; }
.row input.w { width: 150px; }
.row .u { width: 26px; color: #666; font-size: 11px; }
.btns { display: flex; gap: 6px; padding: 8px 8px 0; flex-wrap: wrap; }
.btn { font: inherit; padding: 4px 12px; border: 1px solid #8a8a8a; border-radius: 2px; background: linear-gradient(#fff, #e3e3e3); cursor: pointer; }
.btn:hover { background: linear-gradient(#fff, #d8e6fa); }
.btn.pri { background: linear-gradient(#e9775f, #c84a33); color: #fff; border-color: #9b3524; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.note { font-size: 11.5px; color: #555; padding: 4px 8px; }
.warn { color: #b02a1a; }
#center { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#viewbar { background: #f2f1ee; border-bottom: 1px solid #b9b9b9; display: flex; gap: 2px; padding: 2px 6px; align-items: center; }
#viewbar .ib { width: 30px; height: 26px; }
#viewbar .ib svg { width: 20px; height: 20px; }
#viewbar .vsep { width: 1px; height: 20px; background: #bbb; margin: 0 4px; }
#canvasWrap { flex: 1; position: relative; background: #f0f0f0; overflow: hidden; touch-action: none; }
#rulerTop { position: absolute; left: 22px; top: 0; right: 0; height: 22px; background: #fff; border-bottom: 1px solid #999; }
#rulerLeft { position: absolute; left: 0; top: 22px; bottom: 0; width: 22px; background: #fff; border-right: 1px solid #999; }
#rulerCorner { position: absolute; left: 0; top: 0; width: 22px; height: 22px; background: #fff; border-right: 1px solid #999; border-bottom: 1px solid #999; }
#cv { position: absolute; left: 22px; top: 22px; }
#hint { position: absolute; left: 30px; bottom: 6px; background: rgba(255,255,225,.95); border: 1px solid #aaa; padding: 3px 8px; font-size: 12px; display: none; }
#bottombar { display: flex; align-items: center; background: #f2f1ee; border-top: 1px solid #b9b9b9; padding: 3px 6px; gap: 10px; }
#palette { display: flex; gap: 3px; align-items: center; }
.sw { width: 26px; height: 22px; border: 1px solid #555; cursor: pointer; }
.sw.on { outline: 2px solid #2a62b8; outline-offset: 1px; }
#status { margin-left: auto; font-size: 12px; color: #333; white-space: nowrap; display: flex; gap: 12px; }
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 100; display: flex; align-items: center; justify-content: center; }
#modalBox { background: #f0f0f0; border: 1px solid #6d6d6d; box-shadow: 4px 6px 18px rgba(0,0,0,.35); min-width: 320px; max-width: 96vw; max-height: 94vh; overflow: auto; }
.mh { background: #fff; padding: 7px 12px; display: flex; justify-content: space-between; border-bottom: 1px solid #ccc; }
.mh .x { cursor: pointer; font-size: 16px; padding: 0 4px; }
.mb { padding: 10px 12px; }
.mf { padding: 8px 12px 12px; display: flex; gap: 8px; justify-content: flex-end; }
.list { background: #fff; border: 1px solid #8f8f8f; min-height: 150px; overflow: auto; }
.list .li { padding: 3px 6px; cursor: pointer; white-space: nowrap; }
.list .li.on { background: #3a6fc4; color: #fff; }
.list .lh { padding: 2px 6px; background: #ececec; border-bottom: 1px solid #ccc; font-size: 12px; display: flex; gap: 12px; }
.tree .node { padding: 2px 4px; cursor: pointer; white-space: nowrap; }
.tree .node.on { background: #3a6fc4; color: #fff; }
.tree .grpn { font-weight: 600; }
.lay { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-bottom: 1px solid #eee; cursor: pointer; }
.lay.on { background: #dde8f8; }
.lay .dot { width: 14px; height: 14px; border: 1px solid #555; }
.lay .nm { flex: 1; }
.lay .t { cursor: pointer; opacity: .8; }
.tpi { padding: 4px 6px; border-bottom: 1px solid #e3e3e3; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.tpi.on { background: #dde8f8; }
.tpi .nm { flex: 1; }
.tpi small { color: #555; display: block; }
@media (max-width: 760px) { #left { width: 236px; min-width: 236px; } .ib { width: 36px; height: 34px; } }

/* --- 0.3: язык, руководство, вертикальный экран --- */
#langSel { margin-left: 8px; font: inherit; font-size: 12px; padding: 1px 2px; max-width: 150px; }
#titlebar .site { margin-left: 8px; color: #2a62b8; text-decoration: none; font-weight: 600; }
#modalBox.wide { width: min(860px, 96vw); }
.guide { padding: 4px 10px 10px; line-height: 1.5; font-size: 14px; max-height: 76vh; overflow: auto; background: #fff; }
.guide .hh1 { font-size: 20px; color: #1f5fbf; margin: 8px 0 6px; }
.guide .hh2 { font-size: 17px; color: #1f5fbf; margin: 14px 0 4px; }
.guide .hh3 { font-size: 15px; margin: 10px 0 2px; }
.guide ul, .guide ol { margin: 2px 0 6px; padding-inline-start: 22px; }
.guide li.sub { margin-inline-start: 18px; list-style: circle; }
.guide p { margin: 4px 0; }
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; padding: 6px; }
label.rw { display: flex; gap: 6px; align-items: center; margin: 3px 0; cursor: pointer; }
@media (orientation: portrait) and (max-width: 900px) {
  #main { flex-direction: column-reverse; }
  #left { width: 100%; min-width: 0; height: 44%; border-right: 0; border-top: 2px solid #8a96a8; }
  #center { min-height: 0; }
  #titlebar .ver { display: none; }
}
