/* ExFront Place shell: ONE unified workspace for every block of the page.
   Left rail = shared Insert (active block), center = the stacked block
   canvases in page order + one shared toolbar, right rail = the page
   Layers tree (block roots) + the active block's inspector portal. */

html, body.exfront-place {
    margin: 0;
    height: 100%;
    background: #000;
    color: #fff;
    font-family: Arial, "Helvetica Neue", sans-serif;
}
#app, .exfront-place-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.exfront-place-rail {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 44px;
    padding: 6px 16px;
    background: #050506;
    border-bottom: 1px solid #2e3239;
}
.exfront-place-logo { height: 18px; opacity: .85; }
.exfront-place-count {
    color: #666d79;
    font: 700 10px/1 ui-monospace, monospace;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.exfront-place-error {
    color: #ff8a94;
    font-size: 11px;
    margin-left: auto;
}
.exfront-place-empty {
    margin: 40px auto;
    color: #666d79;
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-align: center;
}

/* ── Unified 3-panel layout ─────────────────────────────────────── */
.exfront-unified {
    display: grid;
    grid-template-columns: 232px minmax(420px, 1fr) 396px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #050506;
}
.exfront-rail-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #090a0d;
}
.exfront-rail-panel.is-left { border-right: 1px solid #2e3239; }
.exfront-rail-panel.is-right { border-left: 1px solid #2e3239; }
.exfront-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border-bottom: 1px solid #2e3239;
    color: #fff;
    font: 700 9px/1 ui-monospace, monospace;
    letter-spacing: .12em;
}
.exfront-rail-head span {
    overflow: hidden;
    color: #666d79;
    font-size: 8px;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}
/* Portaled panels fill the rail and let it own scrolling. */
.exfront-rail-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}
.exfront-rail-body.is-inspector { border-top: 1px solid #1c2027; }
.exfront-rail-body > .mk-ex-library,
.exfront-rail-body > .mk-ex-inspector {
    width: 100%;
    max-height: none;
    border: 0;
    flex: 1;
    min-height: 0;
}

/* ── Canvas column: shared toolbar + block stack ────────────────── */
.exfront-unified-canvas {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #08090b;
}
.exfront-unified-toolbar {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 42px;
    border-bottom: 1px solid #2e3239;
    background: #0b0d11;
}
.exfront-unified-toolbar-active {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: stretch;
}
/* The active block's portaled toolbar fills its slot. */
.exfront-unified-toolbar-active > .mk-ex-canvas-toolbar {
    flex: 1;
    min-width: 0;
    border: 0;
}
.exfront-unified-toolbar-shared {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border-left: 1px solid #2e3239;
}
.exfront-unified-toolbar-shared button {
    padding: 7px 9px;
    border: 1px solid var(--ex-line, #343943);
    background: #0d0f12;
    color: #a1a7b3;
    font: 700 9px/1 ui-monospace, monospace;
    letter-spacing: .08em;
    cursor: pointer;
    white-space: nowrap;
}
.exfront-unified-toolbar-shared button.is-active {
    color: #fff;
    border-color: #ca0274;
    box-shadow: inset 0 -2px 0 #ca0274;
}
.exfront-unified-toolbar-shared select {
    padding: 6px;
    border: 1px solid #343943;
    background: #0d0f12;
    color: #c9cdd5;
    font: 700 9px/1 ui-monospace, monospace;
}
.exfront-unified-stack {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}
.exfront-unified-block {
    border-bottom: 2px solid #343943;
    background: #08090b;
}
.exfront-unified-block.is-active { background: #0a0c10; }
.exfront-unified-strip {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 34px;
    padding: 0 10px;
    border-bottom: 1px solid #2e3239;
    background: rgba(8, 9, 11, .96);
    backdrop-filter: blur(10px);
    color: #c9cdd5;
    font: 700 9px/1 ui-monospace, monospace;
    letter-spacing: .08em;
    cursor: pointer;
    user-select: none;
}
.exfront-unified-block.is-active .exfront-unified-strip {
    color: #fff;
    box-shadow: inset 0 -2px 0 #ca0274;
}
.exfront-unified-strip-index { color: #555c68; }
.exfront-unified-strip > strong {
    overflow: hidden;
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.exfront-unified-strip > code { color: #666d79; font-size: 9px; }
.exfront-unified-strip-tools { display: flex; }
.exfront-unified-strip-tools button {
    min-width: 28px;
    height: 25px;
    padding: 0 6px;
    border: 1px solid #343943;
    background: #0d0f12;
    color: #a1a7b3;
    font: 700 9px/1 ui-monospace, monospace;
    cursor: pointer;
}
.exfront-unified-strip-tools button + button { border-left: 0; }
.exfront-unified-strip-tools button:hover:not(:disabled) { color: #fff; background: #20232a; }
.exfront-unified-strip-tools button:disabled { opacity: .25; cursor: default; }
.exfront-unified-strip-tools button.is-danger {
    color: #ff8a94;
    border-color: #8a2734;
}
/* Per-block gap stepper: − [Npx] + on the strip, space below this block. */
.exfront-strip-gap {
    display: flex;
    align-items: center;
    margin-right: 6px;
    border: 1px solid #2a2e36;
    background: #0b0d11;
}
.exfront-strip-gap button {
    min-width: 22px;
    height: 23px;
    border: 0;
}
.exfront-strip-gap button + button { border-left: 0; }
.exfront-strip-gap code {
    min-width: 34px;
    color: #c9cdd5;
    font: 700 9px/1 ui-monospace, monospace;
    text-align: center;
}
/* Embedded workspaces paint canvas-only; the engine hides its chrome. */
.exfront-unified-block > .mk-home-hero-workspace { min-height: 560px; }
.exfront-unified-unsupported {
    display: grid;
    place-content: center;
    gap: 8px;
    min-height: 240px;
    color: #666d79;
    text-align: center;
}
.exfront-unified-unsupported strong { color: #fff; font: 700 12px/1 ui-monospace, monospace; }

/* ── Seamless page view ───────────────────────────────────────────
   PAGE on: the workspace chrome between blocks disappears — no strips,
   no dividers, no stage padding/grid/frames, no per-block toolbar. The
   stack becomes the page itself; only the real per-block gaps remain. */
.exfront-place-root.is-page-view .exfront-unified-stack {
    background: #fff;
}
.exfront-place-root.is-page-view .exfront-unified-block {
    border-bottom: 0;
    background: #fff;
}
.exfront-place-root.is-page-view .exfront-unified-strip {
    display: none;
}
.exfront-place-root.is-page-view .exfront-unified-toolbar-active {
    display: none;
}
.exfront-place-root.is-page-view .mk-home-hero-workspace.is-embedded {
    min-height: 0;
}
.exfront-place-root.is-page-view .mk-ex-canvas-stage {
    min-height: 0;
    padding: 0;
    background: #fff;
    background-image: none;
    overflow: visible;
}
.exfront-place-root.is-page-view .mk-ex-canvas-axis,
.exfront-place-root.is-page-view .mk-ex-canvas-footer {
    display: none;
}
.exfront-place-root.is-page-view .mk-hero-preview-scale-wrap {
    border: 0;
    box-shadow: none;
}
.exfront-place-root.is-page-view .mk-ex-canvas-column {
    overflow: visible;
}

/* ── Layers rail: page root + block roots ───────────────────────── */
.exfront-layer-page-row {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 38px;
    padding: 0 8px 0 10px;
    border-bottom: 1px solid #1c2027;
}
.exfront-layer-page-row > span { color: #ca0274; font: 700 8px/1 ui-monospace, monospace; }
.exfront-layer-page-row > strong {
    overflow: hidden;
    color: #c9cdd5;
    font: 700 10px/1 ui-monospace, monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.exfront-layer-add > button {
    padding: 6px 9px;
    border: 1px solid #343943;
    background: #0d0f12;
    color: #a1a7b3;
    font: 700 9px/1 ui-monospace, monospace;
    cursor: pointer;
    white-space: nowrap;
}
.exfront-layer-add > button:hover { color: #fff; border-color: #ca0274; }
.exfront-add-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 8px;
    z-index: 60;
    display: grid;
    min-width: 240px;
    max-height: 320px;
    overflow: auto;
    border: 1px solid #3a3e47;
    background: #0b0d12;
    box-shadow: 0 16px 44px rgba(0,0,0,.6);
}
.exfront-add-menu button {
    display: grid;
    gap: 3px;
    padding: 9px 12px;
    border: 0;
    background: transparent;
    color: #fff;
    text-align: left;
    cursor: pointer;
}
.exfront-add-menu button:hover { background: #17191e; }
.exfront-add-menu strong { font: 700 10px/1 ui-monospace, monospace; text-transform: uppercase; }
.exfront-add-menu code { color: #666d79; font: 8px/1 ui-monospace, monospace; }
.exfront-layer-rows { padding: 4px 0; }
.exfront-layer-row {
    display: grid;
    grid-template-columns: 14px 26px minmax(0, 1fr);
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 0 8px 0 6px;
    border: 0;
    border-left: 2px solid transparent;
    color: #c9cdd5;
    cursor: pointer;
    user-select: none;
}
.exfront-layer-row:hover { background: #101216; }
.exfront-layer-row.is-active {
    background: #17191e;
    border-left-color: #ca0274;
}
.exfront-layer-branch { color: #555c68; font: 700 8px/1 ui-monospace, monospace; }
.exfront-layer-icon {
    color: #666d79;
    font: 700 7px/1 ui-monospace, monospace;
    letter-spacing: .06em;
}
.exfront-layer-row.is-active .exfront-layer-icon { color: #ca0274; }
.exfront-layer-label { display: grid; gap: 3px; min-width: 0; }
.exfront-layer-label strong,
.exfront-layer-label code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exfront-layer-label strong { font: 700 10px/1 ui-monospace, monospace; text-transform: uppercase; }
.exfront-layer-label code { color: #666d79; font: 8px/1 ui-monospace, monospace; }
.exfront-inspector-empty {
    padding: 18px 16px;
    border-top: 1px solid #1c2027;
    color: #777e8a;
    font-size: 11px;
    line-height: 1.6;
}
.exfront-inspector-empty strong {
    display: block;
    margin-bottom: 6px;
    color: #fff;
    font: 700 10px/1 ui-monospace, monospace;
    text-transform: uppercase;
}

@media (max-width: 1280px) {
    .exfront-unified { grid-template-columns: 200px minmax(360px, 1fr) 360px; }
}
@media (max-width: 980px) {
    .exfront-unified { grid-template-columns: minmax(0, 1fr) 340px; }
    .exfront-rail-panel.is-left { display: none; }
}
