:root {
    --lhe-primary: #1a365d;
    --lhe-accent: #c5a059;
    --lhe-bg: #eef1f5;
    --lhe-panel: #ffffff;
    --lhe-border: #dde3ea;
    --lhe-text: #1f2937;
    --lhe-muted: #6b7280;
    --lhe-left-w: 300px;
    --lhe-right-w: 280px;
    --lhe-top-h: 56px;
}

.lhe-body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    color: var(--lhe-text);
    background: var(--lhe-bg);
    overflow: hidden;
}

.lhe-app,
.lhe-app * {
    box-sizing: border-box;
}

.lhe-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* Override site-wide button rules (style.css) inside the editor shell */
.lhe-app button {
    width: auto;
    height: auto;
    min-height: unset;
    max-width: 100%;
    color: inherit;
    background: transparent;
}

.lhe-app button.lhe-btn,
.lhe-app button.lhe-tb-btn,
.lhe-app button.lhe-toggle-btn,
.lhe-app button.lhe-sidebar-tab,
.lhe-app button.lhe-menu-item,
.lhe-app button.lhe-toolbar-menu-item,
.lhe-app button.lhe-preview-mode,
.lhe-app button.lhe-assets-tab,
.lhe-app button.lhe-icon-btn,
.lhe-app button.lhe-pattern-btn,
.lhe-app button.lhe-mobile-nav-btn,
.lhe-app button.lhe-mobile-fab {
    width: auto;
    height: auto;
}

.lhe-topbar {
    min-height: var(--lhe-top-h);
    background: var(--lhe-panel);
    border-bottom: 1px solid var(--lhe-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    flex-shrink: 0;
}

.lhe-topbar-left,
.lhe-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.lhe-topbar-left {
    flex: 1;
}

.lhe-topbar-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.lhe-topbar-meta {
    margin: 0;
    font-size: 0.75rem;
    color: var(--lhe-muted);
}

.lhe-save-status {
    font-size: 0.75rem;
    color: var(--lhe-muted);
    min-width: 4.5rem;
    text-align: right;
}

.lhe-save-status.is-saving { color: #d97706; }
.lhe-save-status.is-saved { color: #059669; }
.lhe-save-status.is-error { color: #dc2626; }

.lhe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--lhe-border);
    background: #fff;
    color: var(--lhe-text);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.lhe-btn:hover { background: #f8fafc; }
.lhe-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.lhe-btn-primary { background: var(--lhe-primary); border-color: var(--lhe-primary); color: #fff; }
.lhe-btn-primary:hover { background: #153052; }
.lhe-btn-accent { background: var(--lhe-accent); border-color: var(--lhe-accent); color: #fff; }
.lhe-btn-accent:hover { filter: brightness(0.95); }
.lhe-btn-ghost { background: transparent; }
.lhe-btn-icon { padding: 0.45rem 0.55rem; }
.lhe-btn-sm { padding: 0.25rem 0.5rem; min-width: 2rem; }
.lhe-btn-block { width: 100%; margin-top: 0.5rem; }

.lhe-workspace {
    display: grid;
    grid-template-columns: var(--lhe-left-w) 1fr var(--lhe-right-w);
    flex: 1;
    min-height: 0;
}

.lhe-sidebar {
    background: var(--lhe-panel);
    border-right: 1px solid var(--lhe-border);
    overflow: auto;
    padding: 0.75rem;
}

.lhe-sidebar-right {
    border-right: 0;
    border-left: 1px solid var(--lhe-border);
}

.lhe-panel {
    background: #fff;
    border: 1px solid var(--lhe-border);
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
}

.lhe-panel-muted { background: #f8fafc; }
.lhe-panel-title {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lhe-panel-subtitle {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.lhe-panel-hint {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    color: var(--lhe-muted);
    line-height: 1.4;
}

.lhe-form label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--lhe-muted);
    margin-bottom: 0.65rem;
}

.lhe-form input,
.lhe-form textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--lhe-text);
}

.lhe-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.lhe-panel label,
#lhe-properties-panel label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--lhe-muted);
    margin-bottom: 0.65rem;
}

.lhe-panel input[type="text"],
.lhe-panel input[type="number"],
.lhe-panel input[type="email"],
.lhe-panel input[type="search"],
.lhe-panel input[type="color"],
.lhe-panel select,
.lhe-panel textarea,
.lhe-input,
.lhe-select {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--lhe-text);
    box-sizing: border-box;
}

.lhe-panel input[type="color"] {
    height: 36px;
    padding: 2px 4px;
    cursor: pointer;
}

.lhe-panel input[type="range"] {
    width: 100%;
    margin-top: 0.35rem;
}

.lhe-app button.lhe-toggle-btn {
    flex: 1;
    min-width: 2.25rem;
    min-height: 36px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--lhe-border);
    background: #fff;
    border-radius: 8px;
    font-size: 0.8125rem;
    color: var(--lhe-text);
    cursor: pointer;
}

.lhe-app button.lhe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--lhe-border);
    background: #fff;
    color: var(--lhe-text);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.lhe-app button.lhe-sidebar-tab {
    flex: 1;
    min-height: 34px;
    padding: 0.55rem 0.35rem;
    border: 0;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--lhe-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.lhe-assets-pane {
    display: none;
}

.lhe-assets-pane.is-active {
    display: block !important;
}

.lhe-panel select,
.lhe-select,
.lhe-panel select option {
    color: var(--lhe-text);
    background: #fff;
}

.lhe-brand-kit-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
}

.lhe-brand-logo-preview {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.lhe-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--lhe-border);
    border-radius: 8px;
    padding: 0.65rem;
    font-size: 0.8125rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.lhe-color-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.lhe-color-row input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
}

.lhe-center {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #e5e9ef;
    flex: 1;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.lhe-center-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.45rem;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--lhe-border);
}

.lhe-toolbar-divider {
    width: 1px;
    height: 1.25rem;
    background: var(--lhe-border);
    margin: 0 0.15rem;
}

.lhe-style-row {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.lhe-toggle-btn {
    flex: 1;
    min-width: 2.25rem;
    border: 1px solid var(--lhe-border);
    background: #fff;
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--lhe-text);
    cursor: pointer;
}

.lhe-toggle-btn:hover { background: #f8fafc; }
.lhe-toggle-btn.is-active {
    background: var(--lhe-primary);
    border-color: var(--lhe-primary);
    color: #fff;
}

#lhe-prop-opacity {
    width: 100%;
    margin-top: 0.35rem;
}

#lhe-zoom-label {
    min-width: 3rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--lhe-muted);
}

.lhe-canvas-wrap {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    touch-action: none;
}

.lhe-canvas-scene {
    display: grid;
    grid-template-columns: 22px 1fr;
    grid-template-rows: 22px 1fr;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.lhe-canvas-scene .lhe-canvas-wrap {
    grid-column: 2;
    grid-row: 2;
    padding: 1rem;
}

.lhe-ruler-corner {
    grid-column: 1;
    grid-row: 1;
    background: #f1f5f9;
    border-right: 1px solid var(--lhe-border);
    border-bottom: 1px solid var(--lhe-border);
    display: none;
}

.lhe-ruler-h {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 22px;
    display: none;
    border-bottom: 1px solid var(--lhe-border);
    background: #f8fafc;
}

.lhe-ruler-v {
    grid-column: 1;
    grid-row: 2;
    width: 22px;
    height: 100%;
    display: none;
    border-right: 1px solid var(--lhe-border);
    background: #f8fafc;
}

.lhe-canvas-scene.has-rulers .lhe-ruler-corner,
.lhe-canvas-scene.has-rulers .lhe-ruler-h,
.lhe-canvas-scene.has-rulers .lhe-ruler-v {
    display: block;
}

.lhe-canvas-wrap.is-dragover {
    outline: 2px dashed var(--lhe-accent);
    outline-offset: 4px;
    background: rgba(197, 160, 89, 0.08);
}

.lhe-recent-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.35rem 0 0.5rem;
}

.lhe-recent-swatch {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid var(--lhe-border);
    cursor: pointer;
    padding: 0;
}

.lhe-version-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 360px;
    overflow-y: auto;
}

.lhe-version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--lhe-border);
    border-radius: 6px;
    background: #fafbfc;
}

.lhe-version-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.lhe-version-meta strong {
    font-size: 0.8rem;
}

.lhe-version-meta small {
    font-size: 0.7rem;
    color: var(--lhe-muted);
}

.lhe-btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
}

.lhe-canvas-stage {
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
    background: #fff;
    transform-origin: center center;
}

.lhe-guide-legend {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.75rem;
    color: var(--lhe-muted);
}

.lhe-guide-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.lhe-guide-swatch--bleed { background: #f59e0b; opacity: 0.8; }
.lhe-guide-swatch--safe { background: #22c55e; opacity: 0.8; }
.lhe-guide-swatch--trim { background: #ef4444; opacity: 0.9; }

.lhe-var-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.lhe-var-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--lhe-border, #e2e8f0);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 0.72rem;
    color: var(--lhe-text, #0f172a);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.lhe-var-chip:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.lhe-var-chip code {
    font-size: 0.68rem;
    color: #1d4ed8;
    background: #eff6ff;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.lhe-var-chip span {
    color: var(--lhe-muted, #64748b);
}

.lhe-var-chip--image i,
.lhe-var-chip--block i {
    color: #6366f1;
    margin-bottom: 0.1rem;
}

.lhe-admin-var-section + .lhe-admin-var-section {
    margin-top: 1rem;
}

.lhe-admin-preview-toggle {
    display: flex !important;
    align-items: center;
    gap: 0.45rem;
    margin: 0.75rem 0 0.25rem;
    font-size: 0.8rem !important;
}

.lhe-admin-locks {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--lhe-border, #e2e8f0);
}

.lhe-lock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
    margin: 0.65rem 0;
}

.lhe-layer-var {
    font-size: 0.62rem;
    color: #1d4ed8;
    background: #eff6ff;
    padding: 0.05rem 0.25rem;
    border-radius: 3px;
    margin-left: 0.25rem;
}

.lhe-layer-lock {
    margin-left: 0.35rem;
    font-size: 0.65rem;
    color: #b45309;
}

.lhe-layer-action:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.lhe-check {
    display: flex !important;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem !important;
    color: var(--lhe-text) !important;
}

.lhe-form select {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font: inherit;
    font-size: 0.8125rem;
    background: #fff;
}

.lhe-print-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
}

.lhe-print-badge--ok { background: #dcfce7; color: #166534; }
.lhe-print-badge--warn { background: #fef3c7; color: #92400e; }
.lhe-print-badge--pending { background: #e2e8f0; color: #475569; }

.lhe-print-issues {
    margin: 0.5rem 0 0.75rem;
    padding-left: 1rem;
    font-size: 0.75rem;
    color: var(--lhe-muted);
}

.lhe-print-issue { margin-bottom: 0.35rem; cursor: default; }
.lhe-print-issue[data-slot-key] { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; }
.lhe-print-issue--error { color: #b91c1c; }
.lhe-print-issue--warning { color: #b45309; }

.lhe-order-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--lhe-primary);
    margin: 0.75rem 0;
}

.lhe-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.lhe-modal[hidden] { display: none !important; }

.lhe-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.lhe-modal-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    background: #fff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.lhe-modal-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.lhe-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.lhe-mobile-tab,
.lhe-mobile-drawer {
    display: none;
}

@media (max-width: 960px) {
    .lhe-workspace {
        grid-template-columns: 1fr;
    }

    .lhe-sidebar-left,
    .lhe-sidebar-right {
        display: none !important;
    }

    .lhe-mobile-tab {
        display: flex;
        position: fixed;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        z-index: 60;
        align-items: center;
        gap: 0.4rem;
        padding: 0.65rem 1rem;
        border-radius: 999px;
        border: 0;
        background: var(--lhe-primary);
        color: #fff;
        box-shadow: 0 8px 24px rgba(26, 54, 93, 0.35);
        cursor: pointer;
    }

    .lhe-mobile-drawer {
        display: block;
        position: fixed;
        inset: auto 0 0 0;
        max-height: 70vh;
        background: #fff;
        border-top: 1px solid var(--lhe-border);
        border-radius: 16px 16px 0 0;
        padding: 1rem;
        overflow: auto;
        z-index: 55;
        box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.15);
    }

    .lhe-topbar-right .lhe-btn:not(#lhe-btn-save):not(.lhe-btn-icon) {
        display: none;
    }
}

/* Phase 8 — CMYK preview, mockups, paper texture */
.lhe-canvas-wrap {
    position: relative;
}

.lhe-paper-texture {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-size: 280px 280px;
    mix-blend-mode: multiply;
    opacity: 0;
    z-index: 2;
    border-radius: 4px;
}

.lhe-heatmap-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    object-fit: contain;
}

.lhe-canvas-stage.is-cmyk-proof {
    filter: saturate(0.86) contrast(1.06) brightness(0.96) sepia(0.05) hue-rotate(-4deg);
}

.lhe-rich-black-tip {
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 4;
    background: rgba(26, 54, 93, 0.92);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.45;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
}

.lhe-preview-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.lhe-app button.lhe-preview-mode {
    width: auto;
    height: auto;
    min-height: 34px;
    padding: 0.4rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--lhe-border);
    background: #fff;
    color: var(--lhe-text);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.lhe-preview-mode.is-active {
    background: var(--lhe-primary);
    color: #fff;
    border-color: var(--lhe-primary);
}

.lhe-ink-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.lhe-ink-stat {
    background: var(--lhe-bg);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
}

.lhe-ink-label {
    display: block;
    color: var(--lhe-muted);
    margin-bottom: 0.15rem;
}

.lhe-ink-warnings {
    margin: 0 0 0.75rem;
    padding-left: 1rem;
    font-size: 0.72rem;
    color: #b45309;
}

.lhe-select {
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.45rem 0.5rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    font-size: 0.85rem;
}

.lhe-preview-actions {
    display: grid;
    gap: 0.5rem;
}

.lhe-modal-card-wide {
    max-width: 920px;
    width: calc(100vw - 2rem);
}

.lhe-mockup-scenes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.lhe-app button.lhe-mockup-scene-btn {
    width: auto;
    height: auto;
    min-height: 32px;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--lhe-border);
    background: #fff;
    font-size: 0.75rem;
    cursor: pointer;
}

.lhe-mockup-scene-btn.is-active {
    background: var(--lhe-primary);
    color: #fff;
    border-color: var(--lhe-primary);
}

.lhe-mockup-stage {
    background: #eef1f5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.lhe-mockup-scene {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.lhe-mockup-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lhe-mockup-design {
    position: absolute;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    border-radius: 2px;
    overflow: hidden;
    background: #fff;
}

.lhe-mockup-design img {
    width: 100%;
    height: auto;
    display: block;
}

/* Phase 9 — Icons, patterns, QR assets */
.lhe-assets-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.lhe-app button.lhe-assets-tab {
    flex: 1;
    width: auto;
    height: auto;
    min-height: 32px;
    padding: 0.35rem 0.4rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    background: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.lhe-assets-tab.is-active {
    background: var(--lhe-primary);
    color: #fff;
    border-color: var(--lhe-primary);
}

.lhe-input {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    font-size: 0.85rem;
}

.lhe-icon-grid,
.lhe-pattern-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    max-height: 220px;
    overflow: auto;
    margin-top: 0.5rem;
}

.lhe-app button.lhe-icon-btn,
.lhe-app button.lhe-pattern-btn {
    width: auto;
    height: auto;
    aspect-ratio: 1;
    padding: 0.35rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.lhe-icon-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lhe-pattern-btn {
    background-size: cover;
    background-position: center;
}

.lhe-check-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    margin: 0.5rem 0 0.75rem;
}

.lhe-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Studio upgrade — toolbar, file menu, mobile shell */
.lhe-app-studio .lhe-topbar-left {
    gap: 0.35rem;
}

.lhe-hide-mobile {
    display: inline;
}

.lhe-menu-bar {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.lhe-menu {
    position: relative;
}

.lhe-menu-trigger {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--lhe-text);
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.lhe-menu-trigger:hover {
    background: #f3f4f6;
}

.lhe-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--lhe-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    padding: 0.35rem;
    z-index: 80;
}

.lhe-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
}

.lhe-menu-item:hover {
    background: #f3f4f6;
}

.lhe-menu-item kbd {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--lhe-muted);
}

.lhe-menu-sep {
    height: 1px;
    background: var(--lhe-border);
    margin: 0.25rem 0;
}

.lhe-menu-check {
    margin-left: auto;
    color: #059669;
}

.lhe-toolbar {
    background: var(--lhe-panel);
    border-bottom: 1px solid var(--lhe-border);
    flex-shrink: 0;
    position: relative;
    z-index: 40;
    overflow: visible;
}

.lhe-toolbar-scroll {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0.35rem 0.5rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.lhe-toolbar-menu[hidden] {
    display: none !important;
}

.lhe-toolbar-menu:not([hidden]) {
    display: block;
}

.lhe-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.lhe-toolbar-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--lhe-muted);
    padding-right: 0.15rem;
}

.lhe-toolbar-btns {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.lhe-toolbar-sep {
    width: 1px;
    align-self: stretch;
    background: var(--lhe-border);
    margin: 0 0.45rem;
    flex-shrink: 0;
}

.lhe-app button.lhe-tb-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--lhe-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.lhe-tb-btn-text {
    width: auto;
    min-width: 48px;
    padding: 0 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.lhe-tb-btn:hover {
    background: #f3f4f6;
    border-color: var(--lhe-border);
}

.lhe-tb-btn.is-active {
    background: #e0e7ff;
    border-color: #6366f1;
    color: #3730a3;
}

.lhe-contact-blocks {
    margin: 0.5rem 0 0.75rem;
}

.lhe-contact-blocks .lhe-style-row {
    margin-top: 0.35rem;
}

.lhe-ai-status {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--lhe-muted, #64748b);
}

.lhe-layout-variant-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 320px;
    overflow: auto;
    margin: 0.75rem 0;
}

.lhe-layout-variant-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
}

.lhe-layout-variant-card:hover {
    border-color: #6366f1;
    background: #f8fafc;
}

.lhe-layout-variant-card strong {
    font-size: 0.95rem;
}

.lhe-layout-variant-card small {
    color: var(--lhe-muted, #64748b);
    font-size: 0.78rem;
    line-height: 1.35;
}

.lhe-tb-btn-file {
    cursor: pointer;
    margin: 0;
}

.lhe-toolbar-dropdown {
    position: relative;
}

.lhe-toolbar-menu {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid var(--lhe-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    padding: 0.25rem;
    z-index: 500;
    max-height: min(70vh, 420px);
    overflow-y: auto;
}

.lhe-toolbar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-radius: 5px;
    font-size: 0.78rem;
    cursor: pointer;
}

.lhe-toolbar-menu-item:hover {
    background: #f3f4f6;
}

.lhe-sidebar-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--lhe-border);
    padding: 0 0.35rem;
    flex-shrink: 0;
}

.lhe-sidebar-tab {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0.55rem 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--lhe-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.lhe-sidebar-tab.is-active {
    color: var(--lhe-primary);
    border-bottom-color: var(--lhe-accent);
}

.lhe-sidebar-panel {
    overflow: auto;
    flex: 1;
    min-height: 0;
}

@media (min-width: 961px) {
    .lhe-sidebar-left,
    .lhe-sidebar-right {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
}

.lhe-toast {
    position: fixed;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: #111827;
    color: #fff;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 100;
}

.lhe-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.lhe-modal-card-wide {
    max-width: 560px;
}

.lhe-design-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 360px;
    overflow: auto;
    margin: 0.75rem 0;
}

.lhe-design-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    border: 1px solid var(--lhe-border);
    border-radius: 10px;
    padding: 0.45rem;
    background: #fff;
    cursor: pointer;
    text-align: left;
}

.lhe-design-card:hover {
    border-color: var(--lhe-accent);
}

.lhe-design-card-thumb {
    width: 56px;
    height: 72px;
    object-fit: contain;
    background: #f9fafb;
    border-radius: 4px;
    flex-shrink: 0;
}

.lhe-design-card-thumb--empty {
    background: linear-gradient(135deg, #eef1f5, #dde3ea);
}

.lhe-design-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.lhe-design-card-body small {
    color: var(--lhe-muted);
    font-size: 0.72rem;
}

.lhe-shortcuts-list {
    margin: 0.5rem 0 1rem;
    padding-left: 1.1rem;
    font-size: 0.85rem;
}

.lhe-shortcuts-list kbd {
    background: #f3f4f6;
    border: 1px solid var(--lhe-border);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.75rem;
}

.lhe-mobile-nav,
.lhe-mobile-sheet,
.lhe-mobile-fab-group {
    display: none;
}

@media (max-width: 960px) {
    .lhe-hide-mobile {
        display: none;
    }

    .lhe-app {
        height: 100dvh;
        height: 100vh;
    }

    .lhe-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        flex: 1;
        min-height: 0;
    }

    /* Sidebars live only in the bottom sheet on mobile — never in the main column */
    .lhe-sidebar-left,
    .lhe-sidebar-right {
        display: none !important;
        visibility: hidden;
        position: absolute;
        width: 0;
        height: 0;
        overflow: hidden;
        pointer-events: none;
    }

    .lhe-topbar {
        padding: 0.35rem 0.65rem;
        min-height: 46px;
        flex-shrink: 0;
    }

    .lhe-topbar-title {
        font-size: 0.88rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 46vw;
    }

    .lhe-topbar-meta,
    .lhe-file-menu,
    .lhe-menu-bar {
        display: none;
    }

    .lhe-toolbar {
        flex-shrink: 0;
    }

    .lhe-toolbar-label,
    .lhe-toolbar-group.lhe-hide-mobile-toolbar {
        display: none;
    }

    .lhe-toolbar-scroll {
        padding: 0.2rem 0.3rem;
    }

    .lhe-app {
        --lhe-mobile-nav-h: 3.55rem;
    }

    .lhe-center {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding-bottom: calc(var(--lhe-mobile-nav-h) + env(safe-area-inset-bottom, 0px));
        transition: padding-bottom 0.22s ease;
    }

    .lhe-app.lhe-sheet-open .lhe-center {
        padding-bottom: calc(
            var(--lhe-sheet-height, 46vh)
            + var(--lhe-mobile-nav-h)
            + env(safe-area-inset-bottom, 0px)
        );
    }

    .lhe-canvas-scene {
        flex: 1;
        min-height: 0;
        display: grid !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: 1fr !important;
        width: 100%;
    }

    .lhe-canvas-scene .lhe-ruler-corner,
    .lhe-canvas-scene .lhe-ruler-h,
    .lhe-canvas-scene .lhe-ruler-v {
        display: none !important;
    }

    .lhe-canvas-scene .lhe-canvas-wrap {
        grid-column: 1;
        grid-row: 1;
        padding: 2px;
    }

    .lhe-canvas-wrap {
        flex: 1;
        min-height: 0;
        height: 100%;
        padding: 2px;
        overflow: hidden;
        align-items: center;
        justify-content: center;
    }

    .lhe-mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        min-height: var(--lhe-mobile-nav-h);
        background: #fff;
        border-top: 1px solid var(--lhe-border);
        z-index: 60;
        padding: 0.35rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
        justify-content: space-evenly;
        align-items: stretch;
        gap: 0.2rem;
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    }

    .lhe-mobile-nav-btn {
        flex: 1 1 0;
        min-width: 0;
        max-width: 5.5rem;
        border: 0;
        background: transparent;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.22rem;
        font-size: 0.64rem;
        font-weight: 500;
        line-height: 1.15;
        color: var(--lhe-muted);
        padding: 0.42rem 0.3rem 0.36rem;
        border-radius: 10px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .lhe-mobile-nav-btn span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .lhe-mobile-nav-btn i {
        font-size: 1.08rem;
    }

    .lhe-mobile-nav-btn.is-active,
    .lhe-mobile-nav-btn-accent {
        color: var(--lhe-primary);
        background: rgba(26, 54, 93, 0.06);
    }

    .lhe-mobile-sheet[hidden] {
        display: none !important;
    }

    .lhe-mobile-sheet:not([hidden]) {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: auto 0 calc(var(--lhe-mobile-nav-h) + env(safe-area-inset-bottom, 0px)) 0;
        max-height: min(46vh, 400px);
        background: #fff;
        border-top: 1px solid var(--lhe-border);
        border-radius: 16px 16px 0 0;
        z-index: 55;
        box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
    }

    .lhe-mobile-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.65rem 0.85rem;
        border-bottom: 1px solid var(--lhe-border);
        flex-shrink: 0;
    }

    .lhe-mobile-sheet-header h3 {
        margin: 0;
        font-size: 0.95rem;
    }

    .lhe-mobile-sheet-body {
        overflow: auto;
        padding: 0.75rem;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    .lhe-mobile-sheet-body .lhe-mobile-mounted-panel {
        display: block !important;
        flex: none;
        overflow: visible;
        min-height: auto;
        margin-bottom: 0.75rem;
    }

    .lhe-mobile-sheet-body .lhe-mobile-mounted-panel:last-child {
        margin-bottom: 0;
    }

    .lhe-mobile-sheet-tabs {
        display: flex;
        gap: 0.25rem;
        margin-bottom: 0.75rem;
        border-bottom: 1px solid var(--lhe-border);
        padding-bottom: 0.35rem;
    }

    .lhe-mobile-sheet-tabs button {
        flex: 1;
        border: 0;
        background: transparent;
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--lhe-muted);
        padding: 0.45rem 0.25rem;
        border-bottom: 2px solid transparent;
        cursor: pointer;
    }

    .lhe-mobile-sheet-tabs button.is-active {
        color: var(--lhe-primary);
        border-bottom-color: var(--lhe-accent);
    }

    .lhe-mobile-sheet-panel[hidden] {
        display: none !important;
    }

    .lhe-mobile-fab-group {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        position: fixed;
        right: 0.65rem;
        bottom: calc(var(--lhe-mobile-nav-h) + 0.55rem + env(safe-area-inset-bottom, 0px));
        z-index: 58;
        transition: transform 0.22s ease, opacity 0.22s ease;
    }

    .lhe-app.lhe-sheet-open .lhe-mobile-fab-group {
        opacity: 0;
        pointer-events: none;
        transform: translateX(120%);
    }

    .lhe-app button.lhe-mobile-fab {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: 0;
        background: var(--lhe-primary);
        color: #fff;
        box-shadow: 0 6px 18px rgba(26, 54, 93, 0.35);
        cursor: pointer;
    }

    .lhe-app button.lhe-mobile-fab.lhe-mobile-fab-accent {
        background: var(--lhe-accent);
    }

    .lhe-toast {
        bottom: calc(var(--lhe-mobile-nav-h) + 0.85rem + env(safe-area-inset-bottom, 0px));
    }

    .lhe-app.lhe-sheet-open .lhe-toast {
        bottom: calc(
            var(--lhe-sheet-height, 46vh)
            + var(--lhe-mobile-nav-h)
            + 0.65rem
            + env(safe-area-inset-bottom, 0px)
        );
    }
}

/* Visiting card / business card — same studio, smaller canvas */
.lhe-app--business-card .lhe-canvas-wrap {
    align-items: center;
    justify-content: center;
}

.lhe-app--business-card .lhe-canvas-stage {
    box-shadow: 0 6px 28px rgba(15, 23, 42, 0.14);
    border-radius: 4px;
    transform-origin: center center;
}

.lhe-app--business-card .lhe-canvas-stage canvas {
    image-rendering: auto;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.lhe-app--business-card .lhe-topbar-meta {
    font-size: 0.78rem;
}

.lhe-panel-admin-meta {
    border-bottom: 1px solid var(--lhe-border);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    background: #f8fafc;
}

.lhe-app--admin-template .lhe-topbar {
    border-bottom: 2px solid #f59e0b;
}

/* Phase A — Shapes, lines, layers, background */
.lhe-toolbar-menu--wide {
    min-width: 200px;
}

.lhe-icon-rotate-270 {
    transform: rotate(-90deg);
    display: inline-block;
}

.lhe-panel-subsection {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--lhe-border);
}

.lhe-layers-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 420px;
    overflow-y: auto;
}

.lhe-layer-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem;
    border: 1px solid var(--lhe-border);
    border-radius: 6px;
    background: #fafbfc;
}

.lhe-layer-item.is-active {
    border-color: var(--lhe-accent);
    background: #fffbeb;
}

.lhe-layer-item.is-hidden {
    opacity: 0.55;
}

.lhe-layer-name {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.25rem 0.35rem;
    font-size: 0.78rem;
    cursor: pointer;
    color: var(--lhe-text);
}

.lhe-layer-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lhe-layer-actions {
    display: flex;
    gap: 0.15rem;
    flex-shrink: 0;
}

.lhe-layer-action {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--lhe-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.lhe-layer-action:hover {
    background: #eef1f5;
    color: var(--lhe-text);
}

.lhe-layer-action--danger:hover {
    background: #fef2f2;
    color: #dc2626;
}
