/* ── Hubbase site builder ── */
.bld { position: fixed; inset: 0; display: flex; flex-direction: column; background: #e9e7e1; }
.bld-top { height: 56px; flex: 0 0 56px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--side); color: #fff; z-index: 5; }
.bld-top .btn { background: #232c37; border-color: #2e3844; color: #fff; }
.bld-top .btn:hover { background: #2c3642; }
.bld-top .btn.accent { background: var(--ember); border-color: var(--ember); }
.bld-top .btn.accent:hover { background: #c43d17; }
.bld-top .seg { background: #232c37; }
.bld-top .seg button { color: #aab3be; }
.bld-top .seg button.on { background: #fff; color: var(--ink); }
.bld-top .seg button svg { width: 16px; height: 16px; display: block; }
.bld-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.bld-title b { font-family: var(--f-display); font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.bld-title small { color: #97a1ad; font-size: 11.5px; }
.bld-page { background: #232c37; border: 1px solid #2e3844; color: #fff; border-radius: 8px; padding: 7px 28px 7px 10px; font-weight: 600; appearance: none; background-image: 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='%23aab3be' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; max-width: 200px; }
.bld-save { font-size: 12.5px; color: #97a1ad; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.bld-save i { width: 7px; height: 7px; border-radius: 999px; background: #3fa46a; }
.bld-save.dirty i { background: #f2b134; }
.bld-save.err i { background: #ef4444; }
.bld-body { flex: 1; display: flex; min-height: 0; }
.bld-rail { width: 64px; flex: 0 0 64px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; }
.bld-rail button { width: 52px; border: 0; background: none; border-radius: 10px; padding: 8px 0 6px; display: grid; justify-items: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 700; }
.bld-rail button svg { width: 20px; height: 20px; }
.bld-rail button:hover { background: var(--sunk); color: var(--ink); }
.bld-rail button.on { background: var(--ember-soft); color: var(--ember); }
.bld-panel { width: 300px; flex: 0 0 300px; background: #fff; border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
.bld-panel .field, .bld-panel .grid > *, .bld-insp .field { min-width: 0; }
.bld-panel.closed { display: none; }
.bp-h { position: sticky; top: 0; background: #fff; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line-2); }
.bp-h h3 { font-size: 16px; flex: 1; }
.bp-b { padding: 14px 16px 30px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.bld-stage { flex: 1; min-width: 0; overflow: hidden; display: flex; justify-content: center; padding: 16px; position: relative; }
.bld-canvas { height: 100%; background: #fff; box-shadow: 0 10px 40px -12px rgba(20,26,34,.35); border-radius: 10px; overflow: hidden; transition: width .25s cubic-bezier(.2,.8,.2,1); max-width: 100%; }
.bld-canvas iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.bld-insp { width: 320px; flex: 0 0 320px; background: #fff; border-left: 1px solid var(--line); overflow-y: auto; }
.bld-insp.closed { display: none; }
.bi-h { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid var(--line-2); }
.bi-title { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 16px; }
.bi-title .ico { width: 30px; height: 30px; border-radius: 8px; background: var(--ember-soft); color: var(--ember); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.bi-title b { font-family: var(--f-display); font-size: 15.5px; flex: 1; }
.bi-tabs { display: flex; padding: 0 12px; gap: 2px; }
.bi-tabs button { flex: 1; border: 0; background: none; padding: 9px 6px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; }
.bi-tabs button.on { color: var(--ink); border-bottom-color: var(--ember); }
.bi-b { padding: 14px 16px 40px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.bi-b .field > span { display: flex; align-items: center; justify-content: space-between; }

/* block library */
.lib-cat { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 6px 0 -4px; }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lib-item { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px; text-align: left; display: grid; gap: 4px; transition: border-color .12s, box-shadow .12s, transform .12s; }
.lib-item:hover { border-color: var(--ink); box-shadow: var(--shadow); transform: translateY(-1px); }
.lib-item .i { width: 30px; height: 30px; border-radius: 8px; background: var(--sunk); display: grid; place-items: center; font-weight: 800; color: var(--ink-2); font-size: 14px; }
.lib-item b { font-size: 12.5px; }
.lib-item small { color: var(--muted); font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-pop { position: fixed; z-index: 60; width: 420px; height: 270px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; pointer-events: none; border: 1px solid var(--line); }
.lib-pop iframe { width: 1280px; height: 820px; border: 0; transform: scale(.328); transform-origin: 0 0; }
.insert-hint { background: var(--slate-soft); color: var(--slate); font-weight: 650; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; display: flex; gap: 8px; align-items: center; }

/* pages + layers */
.pg-list, .ly-list { display: grid; gap: 4px; }
.pg-row, .ly-row { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; }
.pg-row:hover, .ly-row:hover { background: var(--sunk); }
.pg-row.on, .ly-row.on { background: var(--ember-soft); border-color: #f5c9b8; }
.pg-row .t, .ly-row .t { flex: 1; min-width: 0; }
.pg-row .t b, .ly-row .t b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-row .t small, .ly-row .t small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ly-row .ic { width: 26px; height: 26px; border-radius: 7px; background: var(--sunk); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: 0 0 26px; }
.ly-row .grip { color: var(--faint); cursor: grab; display: grid; }
.ly-row .grip svg { width: 15px; height: 15px; }
.ly-row.hid .t { opacity: .45; }
.ly-row.drag-over { border-top: 2px solid var(--ember); }
.mini { border: 0; background: none; color: var(--faint); padding: 4px; border-radius: 6px; display: grid; }
.mini:hover { background: #fff; color: var(--ink); }
.mini svg { width: 15px; height: 15px; }

/* theme panel */
.pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pal { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; text-align: left; display: grid; gap: 6px; }
.pal:hover { border-color: var(--ink); }
.pal .sw { display: flex; height: 22px; border-radius: 6px; overflow: hidden; }
.pal .sw i { flex: 1; }
.pal small { font-weight: 700; font-size: 11.5px; }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type=color] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: none; cursor: pointer; flex: 0 0 34px; }
.color-row input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-row input[type=color]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.color-row span { flex: 1; font-weight: 600; font-size: 12.5px; }
.color-row .in { width: 92px; flex: 0 0 92px; font-family: var(--f-mono); font-size: 12px; padding: 6px 8px; }
.pair-list { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.pair { min-width: 0; overflow: hidden; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 9px 12px; text-align: left; display: flex; align-items: baseline; gap: 10px; }
.pair:hover { border-color: var(--ink); }
.pair.on { border-color: var(--ember); background: var(--ember-soft); }
.pair b { font-size: 19px; line-height: 1.1; }
.pair small { color: var(--muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pair span { white-space: nowrap; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.range-row span { font-weight: 700; font-size: 12px; }
.range-row output { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.range-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--ember); }
details.sec { border: 1px solid var(--line); border-radius: 10px; }
details.sec > summary { list-style: none; cursor: pointer; padding: 11px 12px; font-weight: 750; display: flex; align-items: center; gap: 8px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "+"; margin-left: auto; color: var(--faint); font-size: 18px; line-height: 1; }
details.sec[open] > summary::after { content: "−"; }
details.sec > div { padding: 2px 12px 14px; display: grid; gap: 12px; }

/* inspector widgets */
.bg-sw { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bg-sw button { height: 36px; border-radius: 8px; border: 2px solid var(--line); position: relative; font-size: 9.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.bg-sw button.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.img-field { display: grid; gap: 8px; }
.img-prev { height: 110px; border-radius: 9px; background: var(--sunk) center/cover; border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); font-size: 12px; font-weight: 600; }
.items { display: grid; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 10px; background: #fcfbf9; }
.item-h { display: flex; align-items: center; gap: 4px; padding: 7px 8px 7px 12px; cursor: pointer; }
.item-h b { flex: 1; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-b { padding: 4px 12px 12px; display: grid; gap: 10px; border-top: 1px solid var(--line-2); }
.item:not(.open) .item-b { display: none; }
.rte { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line-2); }
.rte-bar button { border: 0; background: none; padding: 4px 7px; border-radius: 6px; font-weight: 800; font-size: 12px; color: var(--ink-2); min-width: 26px; }
.rte-bar button:hover { background: var(--sunk); }
.rte-body { padding: 10px 12px; min-height: 110px; outline: none; line-height: 1.55; font-size: 13.5px; }
.rte-body h2 { font-size: 18px; margin: .4em 0; } .rte-body h3 { font-size: 15px; margin: .4em 0; }
.rte-body p { margin: 0 0 .6em; } .rte-body ul, .rte-body ol { margin: 0 0 .6em; padding-left: 1.2em; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin-top: 6px; }
.emoji-grid button { border: 0; background: none; font-size: 17px; padding: 4px 0; border-radius: 6px; }
.emoji-grid button:hover { background: var(--sunk); }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stock-grid button { aspect-ratio: 4/3; border-radius: 10px; border: 2px solid transparent; background: var(--sunk) center/cover; }
.stock-grid button:hover { border-color: var(--ink); }
.empty-insp { padding: 30px 20px; text-align: center; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty-insp .big { width: 54px; height: 54px; border-radius: 16px; background: var(--sunk); display: grid; place-items: center; color: var(--faint); }
.kbd { font-family: var(--f-mono); font-size: 11px; background: var(--sunk); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }
@media (max-width: 1180px) { .bld-insp { position: fixed; right: 0; top: 56px; bottom: 0; z-index: 20; box-shadow: var(--shadow-lg); } }
@media (max-width: 900px) { .bld-panel { position: fixed; left: 64px; top: 56px; bottom: 0; z-index: 19; box-shadow: var(--shadow-lg); } .bld-title, .bld-save span { display: none; } }
