: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;
}

.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-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;
}

.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-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-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;
    }

    .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;
    }
}
