:root {
  --bg: #f4f5f8; --panel: #ffffff; --line: #e8eaf0; --line2: #d9dde7; --ink: #151c2e; --ink2: #3b4357;
  --muted: #667085; --faint: #98a2b3; --accent: #4f46e5; --accent-weak: #eef0ff; --accent-ink: #3730a3;
  --green: #12a875; --green-weak: #e6f7f0; --red: #e5484d; --red-weak: #fdecec; --amber: #f59e0b; --amber-weak: #fff4de;
  --r: 10px; --sh1: 0 1px 2px rgba(16,24,40,.06); --sh2: 0 1px 2px rgba(16,24,40,.06), 0 10px 28px rgba(16,24,40,.10);
  --sh3: 0 24px 60px rgba(16,24,40,.22);
  --font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13.5px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ic { flex: none; display: block; }
h1, h2, h3 { margin: 0; }

/* ---------- завантаження і вхід ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 99; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1100px 600px at 20% -10%, #e4e7ff 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #dff5ec 0, transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px 28px 26px; box-shadow: var(--sh2); display: grid; gap: 14px; }
.login-card h1 { font-size: 22px; letter-spacing: -.02em; }
.login-card p { margin: -8px 0 4px; }
.logo-lg, .logo { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 9h16v14H8z' fill='none' stroke='white' stroke-width='2'/%3E%3Cpath d='M8 16h7v7M20 9v5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center/100% no-repeat; }
.logo-lg { width: 46px; height: 46px; border-radius: 13px; }
.logo { width: 26px; height: 26px; border-radius: 8px; }
.err { background: var(--red-weak); color: #b4232a; border-radius: 8px; padding: 8px 11px; font-size: 13px; }

/* ---------- форми та кнопки ---------- */
.field { display: grid; gap: 5px; }
.field > span, .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
select { appearance: none; padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 9px center no-repeat; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.16); }
input[type=number] { padding-right: 4px; }
input[type=color] { width: 34px; height: 34px; padding: 3px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; cursor: pointer; }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line2); background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: #f7f8fb; border-color: #c9cedb; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.4); }
.btn.primary:hover { background: #4338ca; border-color: #4338ca; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-weak); border-color: #f4b9bb; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(21,28,46,.06); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 42px; font-size: 14.5px; border-radius: 11px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.on { background: var(--accent-weak); border-color: #c7caf8; color: var(--accent-ink); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: #eceef4; border-radius: 10px; }
.seg > button { height: 28px; padding: 0 12px; border: 0; background: transparent; border-radius: 7px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg > button:hover { color: var(--ink); }
.seg > button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.seg.full { display: flex; } .seg.full > button { flex: 1; justify-content: center; padding: 0 6px; }
.seg.sm > button { height: 26px; padding: 0 9px; font-size: 12.5px; }

.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: #cdd2dd; border-radius: 20px; transition: .15s; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.row { display: flex; align-items: center; gap: 8px; }
.row.sb { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.kbd { font: 600 11px var(--font); padding: 1px 6px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; background: #fff; color: var(--ink2); }

/* ---------- верхня панель ---------- */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topbar { height: 54px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: -.01em; font-size: 15px; }
.spacer { flex: 1; }
.plans { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.plans::-webkit-scrollbar { display: none; }
.ptab { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid transparent; background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.ptab:hover { background: #f1f2f6; color: var(--ink); }
.ptab.on { background: var(--accent-weak); color: var(--accent-ink); }
.tb-group { display: flex; align-items: center; gap: 4px; }
.tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.savestat { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); min-width: 96px; justify-content: flex-end; }
.savestat .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.savestat.pending .dot, .savestat.saving .dot { background: var(--amber); }
.savestat.error { color: var(--red); } .savestat.error .dot { background: var(--red); }
.userbtn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: 22px; background: transparent; cursor: pointer; font-weight: 600; }
.userbtn:hover { background: #f1f2f6; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700; flex: none; }

/* ---------- каркас ---------- */
.body { flex: 1; display: flex; min-height: 0; }
.left { width: 292px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 10; }
.right { width: 304px; flex: none; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; z-index: 10; }
.stage { position: relative; flex: 1; min-width: 0; background: #eef0f4; overflow: hidden; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; user-select: none; -webkit-user-select: none; }

.panel-h { padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-h h3 { font-size: 13.5px; font-weight: 700; }
.sec { padding: 14px 16px; border-top: 1px solid var(--line); display: grid; gap: 11px; }
.sec:first-child { border-top: 0; }
.sec > h4 { margin: 0; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.unit { position: relative; }
.unit input { padding-right: 30px; }
.unit::after { content: attr(data-u); position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 12px; pointer-events: none; }
.unit.has-lbl { display: grid; gap: 4px; }
.sw-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw { width: 24px; height: 24px; border-radius: 7px; border: 1px solid rgba(23,32,51,.16); cursor: pointer; position: relative; padding: 0; }
.sw.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.pillbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 20px; border: 1px solid var(--line2); background: #fff; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: #bfc5d4; }
.chip.on { background: var(--accent-weak); border-color: #c4c8f7; color: var(--accent-ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.iconbar { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- бібліотека ---------- */
.lib-search { padding: 0 14px 10px; position: relative; }
.lib-search .ic { position: absolute; left: 24px; top: 9px; color: var(--faint); }
.lib-search input { padding-left: 34px; }
.lib-body { flex: 1; overflow-y: auto; padding: 0 10px 20px; }
.lib-cat { margin: 4px 0; }
.lib-cat > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 8px 6px; font-weight: 700; font-size: 12px; color: var(--ink2); letter-spacing: .02em; border-radius: 8px; }
.lib-cat > summary::-webkit-details-marker { display: none; }
.lib-cat > summary:hover { background: #f4f5f8; }
.lib-cat > summary .ic { transition: transform .15s; color: var(--faint); }
.lib-cat[open] > summary .ic { transform: rotate(90deg); }
.lib-cat .cnt { color: var(--faint); font-weight: 600; margin-left: 6px; }
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px 0 6px; }
.card { position: relative; display: grid; grid-template-rows: 62px auto; gap: 4px; padding: 7px 4px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: center; transition: border-color .12s, box-shadow .12s, transform .08s; user-select: none; }
.card:hover { border-color: #b9bdf3; box-shadow: 0 4px 14px rgba(79,70,229,.12); }
.card.on { border-color: var(--accent); background: var(--accent-weak); }
.card svg { width: 100%; height: 100%; }
.card .nm { font-size: 11px; line-height: 1.2; color: var(--ink2); font-weight: 550; min-height: 26px; display: flex; align-items: center; justify-content: center; }
.card .tools { position: absolute; top: 3px; right: 3px; display: none; gap: 2px; }
.card:hover .tools { display: flex; }
.card .tools button { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line2); background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--muted); }
.card .tools button:hover { color: var(--ink); background: #f4f5f8; }
.lib-top { padding: 0 14px 10px; }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; }

/* ---------- полотно: плаваючі елементи ---------- */
.toolrail { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 3px; padding: 5px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh2); z-index: 5; }
.tbtn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 10px; color: var(--ink2); cursor: pointer; }
.tbtn:hover { background: #f1f2f6; }
.tbtn.on { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.35); }
.tbtn .k { position: absolute; right: 3px; bottom: 1px; font-size: 9px; font-weight: 700; opacity: .45; }
.rail-sep { height: 1px; background: var(--line); margin: 3px 6px; }
.tbtn[data-tip]:hover::after, .btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: #151c2e; color: #fff; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 7px; white-space: nowrap; pointer-events: none; z-index: 30; }
.toolopts { position: absolute; left: 66px; top: 12px; right: 190px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 7px 10px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh2); z-index: 5; width: max-content; max-width: calc(100% - 270px); }
.toolopts .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.toolopts .vsep { width: 1px; height: 22px; background: var(--line); }
.wk { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line2); background: #fff; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.wk:hover { border-color: #b9bdf3; }
.wk.on { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-ink); }
.wk i { display: block; width: 22px; border-radius: 2px; }
.viewctl { position: absolute; right: 14px; bottom: 44px; display: flex; flex-direction: column; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh2); overflow: hidden; z-index: 5; }
.viewctl button { width: 38px; height: 36px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--ink2); }
.viewctl button:hover { background: #f1f2f6; }
.viewctl .zl { font-size: 11px; font-weight: 700; color: var(--muted); height: 22px; display: grid; place-items: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.viewctl button.on { background: var(--accent-weak); color: var(--accent); }
.scalebar { position: absolute; left: 14px; bottom: 44px; font-size: 11px; font-weight: 650; color: var(--ink2); pointer-events: none; }
.scalebar i { display: block; height: 7px; border: 1.5px solid var(--ink2); border-top: 0; margin-top: 3px; }
.status { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 14px; background: rgba(255,255,255,.88); border-top: 1px solid var(--line); backdrop-filter: blur(6px); font-size: 12px; color: var(--ink2); z-index: 4; }
.status #hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datebar { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 5px; background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh2); z-index: 5; }
.datebar .dl { min-width: 168px; text-align: center; font-weight: 700; padding: 0 8px; line-height: 1.15; }
.datebar .dl small { display: block; font-weight: 550; color: var(--muted); font-size: 11.5px; }
.fab { display: none; position: absolute; left: 12px; bottom: 44px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; box-shadow: var(--sh2); z-index: 6; place-items: center; }

/* ---------- відділи / розподіл ---------- */
.dept-list { padding: 0 10px 8px; display: grid; gap: 4px; }
.dept { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.dept:hover { border-color: #bfc5d4; }
.dept.on { border-color: var(--accent); background: var(--accent-weak); box-shadow: 0 0 0 1px var(--accent) inset; }
.dept .sq { width: 14px; height: 14px; border-radius: 5px; flex: none; }
.dept .nm { flex: 1; min-width: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dept .n { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 14px 12px; }
.stat { background: #f6f7fa; border-radius: 11px; padding: 9px 10px; }
.stat b { display: block; font-size: 19px; letter-spacing: -.02em; }
.stat span { font-size: 11px; color: var(--muted); font-weight: 600; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--amber-weak); color: #7a4b00; font-size: 12.5px; }
.note.info { background: var(--accent-weak); color: var(--accent-ink); }
.note.ok { background: var(--green-weak); color: #0b6b4b; }
.note.bad { background: var(--red-weak); color: #a1252a; }
.list { display: grid; gap: 2px; }
.li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.li:hover { background: #f3f4f8; }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t span { font-size: 12px; color: var(--muted); }
.legend { display: grid; gap: 7px; font-size: 12.5px; color: var(--ink2); }
.legend div { display: flex; align-items: center; gap: 9px; }
.legend i { width: 18px; height: 14px; border-radius: 4px; border: 1.5px solid; flex: none; }

/* ---------- діалоги ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,22,40,.45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 60; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; box-shadow: var(--sh3); width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2,.9,.3,1.1); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal.wide { max-width: 860px; } .modal.xl { max-width: 1120px; height: min(760px, calc(100vh - 40px)); }
.modal-h { padding: 18px 22px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-h h2 { font-size: 17px; letter-spacing: -.01em; }
.modal-b { padding: 4px 22px 18px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.modal-f .l { margin-right: auto; }
.tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.tabs button { height: 38px; padding: 0 12px; border: 0; background: transparent; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t input, table.t select { height: 30px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: #eef0f5; color: var(--ink2); }
.tag.green { background: var(--green-weak); color: #0b6b4b; } .tag.amber { background: var(--amber-weak); color: #8a5300; } .tag.red { background: var(--red-weak); color: #a1252a; } .tag.blue { background: var(--accent-weak); color: var(--accent-ink); }

/* ---------- меню та тости ---------- */
.menu { position: fixed; min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh2); padding: 5px; z-index: 70; animation: fade .1s; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 550; }
.menu button:hover { background: #f1f2f6; }
.menu button.danger { color: var(--red); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu .kb { margin-left: auto; color: var(--faint); font-size: 11.5px; }
.menu .head { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); }
#toast-root { position: fixed; left: 50%; bottom: 50px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; pointer-events: none; }
.toast { background: #151c2e; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--sh2); font-weight: 550; animation: pop .2s; max-width: 90vw; }
.toast.bad { background: #b4232a; } .toast.ok { background: #0b6b4b; }

/* ---------- конструктор меблів ---------- */
.bld { display: grid; grid-template-columns: 200px 1fr 280px; flex: 1; min-height: 0; border-top: 1px solid var(--line); }
.bld-l { border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; display: grid; gap: 12px; align-content: start; }
.bld-r { border-left: 1px solid var(--line); overflow-y: auto; }
.bld-c { position: relative; background: #eef0f4; min-width: 0; }
.bld-c svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; }
.bld-tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 3px; padding: 5px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh2); }
.bld-hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--muted); background: rgba(255,255,255,.9); padding: 5px 10px; border-radius: 8px; }
.shp { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.shp:hover { background: #f3f4f8; } .shp.on { background: var(--accent-weak); border-color: #c7caf8; }
.shp .pv { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(23,32,51,.25); flex: none; }
.shp .nm { flex: 1; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker { position: absolute; z-index: 10; left: 12px; top: 64px; width: 330px; max-height: 420px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh2); padding: 10px; }

/* ---------- сторінки на вузьких екранах ---------- */
@media (max-width: 960px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand span:last-child { display: none; }
  .modes > button span { display: none; }
  .modes > button { padding: 0 11px; }
  .left { position: absolute; left: 0; top: 54px; bottom: 0; width: min(86vw, 320px); transform: translateX(-102%); transition: transform .2s; box-shadow: var(--sh3); }
  .left.open { transform: none; }
  .right { position: absolute; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 52vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(16,24,40,.14); }
  .right:empty { display: none; }
  .fab { display: grid !important; }
  .toolopts { max-width: calc(100% - 76px); right: 12px; }
  .datebar { top: 8px; }
  .status { display: none; }
  .viewctl { bottom: 14px; } .scalebar { bottom: 14px; }
  .savestat span.tx { display: none; } .savestat { min-width: 0; }
  .userbtn .nm { display: none; }
  .modal.xl { height: calc(100vh - 20px); }
  .bld { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .bld-l, .bld-r { max-height: 30vh; border: 0; }
}

/* ---------- проєкти ---------- */
button.brand { border: 0; background: transparent; cursor: pointer; padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: 10px; color: inherit; font-family: inherit; font-size: 15px; }
button.brand:hover { background: #f1f2f6; }
.home { position: fixed; inset: 0; overflow-y: auto; z-index: 30;
  background: radial-gradient(1100px 600px at 15% -10%, #e4e7ff 0, transparent 60%), radial-gradient(900px 500px at 110% 20%, #dff5ec 0, transparent 55%), var(--bg); }
.home-top { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 22px; }
.home-in { max-width: 1120px; margin: 0 auto; padding: 18px 22px 60px; }
.home-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.home-h h1 { font-size: 28px; letter-spacing: -.02em; }
.home-h p { margin: 4px 0 0; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.pcard { display: flex; flex-direction: column; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; cursor: pointer; box-shadow: var(--sh1); transition: transform .12s, box-shadow .15s, border-color .15s; outline: none; padding: 0; font: inherit; color: inherit; }
.pcard:hover, .pcard:focus-visible { transform: translateY(-3px); box-shadow: var(--sh2); border-color: #c4c8f7; }
.pthumb { height: 190px; background: #eef0f4 linear-gradient(rgba(23,32,51,.05) 1px, transparent 1px) 0 0/20px 20px, linear-gradient(90deg, rgba(23,32,51,.05) 1px, transparent 1px) 0 0/20px 20px; display: grid; place-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.pthumb svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 10px rgba(16,24,40,.12)); }
.pempty { display: grid; justify-items: center; gap: 6px; color: var(--faint); font-weight: 600; }
.pbody { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 18px; }
.pbody b { display: block; font-size: 15.5px; letter-spacing: -.01em; }
.pbody span { color: var(--muted); font-size: 12.5px; }
.pcard.new { border: 2px dashed #c9cedb; background: rgba(255,255,255,.55); align-items: center; justify-content: center; gap: 6px; min-height: 270px; color: var(--accent-ink); box-shadow: none; }
.pcard.new:hover { background: var(--accent-weak); border-color: var(--accent); }
.pcard.new span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 960px) { .home-in { padding: 10px 14px 40px; } .home-h h1 { font-size: 23px; } .pgrid { grid-template-columns: 1fr; } .pthumb { height: 170px; } .home-top .nm { display: none; } }

/* ---------- таблиця людей ---------- */
.people { position: absolute; right: 14px; top: 12px; bottom: 44px; width: 330px; max-width: calc(100% - 28px); display: flex; flex-direction: column; background: rgba(255,255,255,.98); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh2); z-index: 6; overflow: hidden; }
.people .ph { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 16px; }
.people .ps { position: relative; padding: 0 12px 8px; }
.people .ps .ic { position: absolute; left: 22px; top: 9px; color: var(--faint); }
.people .ps input { padding-left: 32px; }
.pcols { display: grid; grid-template-columns: 1fr 92px; padding: 6px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; border-bottom: 1px solid var(--line); background: #fafbfc; }
.plist { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.pg > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 16px; background: #f6f7fa; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.pg > summary::-webkit-details-marker { display: none; }
.pg > summary i { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.pg > summary b { font-weight: 700; }
.pg > summary span { margin-left: auto; font-size: 11.5px; }
.prow { display: grid; grid-template-columns: 1fr 92px; align-items: center; gap: 8px; padding: 7px 16px 7px 30px; border-bottom: 1px solid #f0f1f5; }
.prow .pn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dpill { display: inline-flex; align-items: center; gap: 5px; justify-self: start; height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid #c7caf8; background: var(--accent-weak); color: var(--accent-ink); font-weight: 700; font-size: 12.5px; cursor: pointer; }
.dpill:hover { background: #e0e3ff; border-color: var(--accent); }
.dpill.soft { background: var(--amber-weak); border-color: #f1d49a; color: #8a5300; }
@media (max-width: 960px) { .people { left: 8px; right: 8px; width: auto; top: auto; max-height: 55%; bottom: 8px; } }

/* ---------- логотип та кнопка «i» ---------- */
.sy-logo { height: 24px; width: auto; display: block; flex: none; }
.sy-logo.big { height: 30px; }
.vdiv { width: 1px; height: 24px; background: var(--line2); flex: none; }
button.brand { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.infobtn { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--accent); background: #fff; color: var(--accent); font: italic 700 17px/1 Georgia, 'Times New Roman', serif; cursor: pointer; display: grid; place-items: center; flex: none; transition: background .12s, color .12s, transform .08s; }
.infobtn:hover { background: var(--accent); color: #fff; }
.infobtn:active { transform: scale(.94); }

/* ---------- інструкція зі стрілочками ---------- */
.tour { position: fixed; inset: 0; z-index: 85; }
.tour-shield { position: absolute; inset: 0; }
.tour-hole { position: absolute; border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(15,22,40,.66); outline: 3px solid #fff; transition: left .3s cubic-bezier(.3,.8,.3,1), top .3s cubic-bezier(.3,.8,.3,1), width .3s cubic-bezier(.3,.8,.3,1), height .3s cubic-bezier(.3,.8,.3,1); pointer-events: none; animation: tpulse 1.6s ease-in-out infinite; }
@keyframes tpulse { 0%, 100% { outline-offset: 0; outline-color: #fff; } 50% { outline-offset: 5px; outline-color: #a5b4fc; } }
.tour-arrow { position: absolute; display: none; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); transition: left .3s cubic-bezier(.3,.8,.3,1), top .3s cubic-bezier(.3,.8,.3,1); }
.tour-arrow svg { display: block; animation: tnudge .9s ease-in-out infinite; }
@keyframes tnudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-9px); } }
.tour-card { position: absolute; background: #fff; border-radius: 18px; padding: 18px 18px 14px; box-shadow: 0 24px 60px rgba(0,0,0,.35); transition: left .3s cubic-bezier(.3,.8,.3,1), top .3s cubic-bezier(.3,.8,.3,1), opacity .15s; }
.tour-card.swap { opacity: .35; }
.tour-card h3 { font-size: 17px; letter-spacing: -.01em; margin: 2px 0 6px; padding-right: 22px; }
.tour-card p { margin: 0 0 14px; color: var(--ink2); line-height: 1.5; font-size: 14px; }
.tour-card p b { color: var(--ink); }
.tour-no { font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.tour-x { position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 14px; }
.tour-x:hover { background: #f1f2f6; color: var(--ink); }
.tour-dots { display: flex; gap: 5px; margin-bottom: 14px; flex-wrap: wrap; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: #dfe2ea; }
.tour-dots i.done { background: #b9bdf3; } .tour-dots i.on { background: var(--accent); width: 20px; border-radius: 4px; }
.tour-btns { display: flex; align-items: center; gap: 8px; }
.tour-btns button { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line2); background: #fff; font-weight: 650; cursor: pointer; }
.tour-btns button:hover { background: #f7f8fb; }
.tour-btns .tb-next { background: var(--accent); border-color: var(--accent); color: #fff; padding: 0 18px; }
.tour-btns .tb-next:hover { background: #4338ca; }
.tour-btns .tb-skip { border: 0; background: transparent; color: var(--muted); padding: 0 6px; }
@media (max-width: 960px) { .sy-logo { height: 18px; } .sy-logo.big { height: 24px; } .vdiv { height: 18px; } button.brand #brandName { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
button.brand { white-space: nowrap; }
