.designer-shell {
    background: #f7f8fc;
    padding: 1.25rem 0 2rem;
}

.designer-toolbar,
.designer-toolbar__actions {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.panel-toggles {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.designer-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: calc(100vh - 160px);
}

.designer-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.designer-panel--left {
    flex: 0 0 300px;
    max-width: 320px;
}

.designer-panel--right {
    flex: 0 0 320px;
    max-width: 340px;
}

.canvas-panel {
    flex: 1;
    min-width: 0;
    background: transparent;
}

@media (min-width: 1024px) {
    .designer-layout {
        flex-direction: row;
        align-items: flex-start;
    }
}

.panel-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    padding: 1rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.panel-header .eyebrow {
    margin: 0;
}

.panel-reopen {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.palette {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.palette-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.palette-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.palette-group__title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #475569;
}

.palette-group__items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 10px;
    cursor: grab;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.palette-item:hover {
    border-color: #2563eb;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.palette-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #2563eb;
    border-radius: 8px;
    flex-shrink: 0;
}

.palette-icon .rz-icon {
    font-size: 16px;
}

.palette-label {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
}

.canvas-card {
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 100%;
}

.canvas-surface {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 0.75rem;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    min-height: 60vh;
    overflow: auto;
}

@media (min-width: 1024px) {
    .canvas-surface {
        min-height: 540px;
    }
}

.canvas-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.canvas-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.canvas-dimensions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 0.9rem;
}

.canvas-header__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.canvas-zoom {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
}

.zoom-slider {
    appearance: none;
    width: 120px;
    height: 6px;
    background: linear-gradient(90deg, #dbeafe, #2563eb);
    border-radius: 999px;
    outline: none;
    cursor: pointer;
}

.zoom-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    border: 2px solid #ffffff;
}

.zoom-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    border: 2px solid #ffffff;
}

.zoom-label {
    color: #475569;
    font-weight: 600;
    font-size: 0.9rem;
}

.zoom-value {
    font-weight: 700;
    color: #0f172a;
    min-width: 44px;
    text-align: center;
}

.canvas-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.canvas-element-ribbon {
    margin-top: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.canvas-element-ribbon--collapsed {
    min-height: auto;
    padding: 0.5rem 0.75rem;
}

.ribbon-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
}

.ribbon-group {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 220px;
    min-width: 200px;
}

.ribbon-title {
    font-weight: 700;
    color: #0f172a;
}

.ribbon-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
}

.ribbon-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.4rem;
}

.ribbon-typography {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.4rem;
}

.ribbon-group--format .canvas-tool-button {
    min-width: 36px;
}

.canvas-element-empty {
    color: #475569;
    font-weight: 600;
}

.ribbon-row--collapsed {
    min-height: 32px;
    align-items: center;
}

.ribbon-compact-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ribbon-compact-controls .rz-numeric {
    flex: 0 0 auto;
}

.ribbon-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.ribbon-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.ribbon-summary {
    font-weight: 600;
    color: #0f172a;
}

.ribbon-overlay {
    position: absolute;
    right: 1rem;
    top: calc(100% + 0.5rem);
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    max-width: 960px;
    width: min(960px, 90vw);
    max-height: 70vh;
    overflow: auto;
    padding: 1rem;
    z-index: 1200;
}

.ribbon-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ribbon-overlay__content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.overlay-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.canvas-element-ribbon {
    position: relative;
}
.canvas-shell {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    box-shadow: none;
}

.canvas-workspace {
    width: 100%;
}

.canvas-body {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    flex: 1;
    width: 100%;
}

.canvas-area {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0.5rem 0;
    overflow: auto;
    position: relative;
    background: #f7f8fc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.06);
    min-height: 0;
}

.canvas-area--empty {
    align-items: center;
    justify-content: center;
}

.design-canvas-wrapper {
    position: relative;
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    --canvas-render-width: calc(var(--canvas-width-px, 0px) * var(--canvas-zoom, 1));
    --canvas-render-height: calc(var(--canvas-height-px, 0px) * var(--canvas-zoom, 1));
    min-width: var(--canvas-render-width, 100%);
    min-height: var(--canvas-render-height, 100%);
}

.design-canvas {
    transform-origin: top left;
    position: relative;
    width: var(--canvas-width-px, 100%);
    height: var(--canvas-height-px, auto);
    aspect-ratio: var(--canvas-ratio, 1 / 1);
    background-color: #f7f7f7;
    --grid-step: calc(var(--px-per-mm, 3.78px) * var(--canvas-zoom, 1));
    background-image: linear-gradient(to right, rgba(148, 163, 184, 0.25) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(148, 163, 184, 0.25) 1px, transparent 1px);
    background-size: var(--grid-step) var(--grid-step);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    overflow: visible;
    margin: 0;
    transform: scale(var(--canvas-zoom, 1));
}

.design-canvas:hover {
    border-color: #bfdbfe;
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.14);
}

.design-preview {
    align-self: flex-start;
}

.canvas-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-weight: 500;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.45), rgba(226, 232, 240, 0.25));
}

.canvas-toggle,
.view-toggle {
    padding: 0.15rem 0.35rem;
    display: inline-flex;
}

.design-element {
    position: absolute;
    border: 1px solid #d3d7df;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0.65rem 0.85rem;
    color: #0f172a;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.2s ease, background-color 0.25s ease;
    overflow: visible;
}

.design-element--pattern {
    background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 6px, #e2e8f0 6px, #e2e8f0 12px);
}

.design-element--active {
    border-color: #2563eb;
    background: #f3f7ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28), 0 10px 24px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.design-element--snapped {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35), 0 8px 24px rgba(37, 99, 235, 0.12);
}

@media (max-width: 768px) {
    .canvas-surface {
        min-height: 520px;
    }

    .canvas-body {
        min-height: 420px;
    }

    .zoom-slider {
        width: 100px;
    }
}

.canvas-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.35rem 0.5rem;
}

.canvas-tools__title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
}

.canvas-tools__section {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.canvas-tool-button {
    border: 1px solid #d6dbe6;
    background: #ffffff;
    color: #0f172a;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.canvas-tool-button:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.canvas-tool-button.is-active {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

.element-shortcut-bar {
    position: absolute;
    transform: translate(-50%, -100%);
    display: inline-flex;
    gap: 0.25rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 0.2rem 0.35rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.15);
    z-index: 30;
}

.element-shortcut-bar .rz-button {
    min-width: 28px;
    height: 26px;
    padding: 0;
}

.element-shortcut-floating {
    pointer-events: auto;
    left: 50%;
}

.move-handle {
    cursor: move;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: #334155;
    user-select: none;
    padding-top: 0.2rem;
    border-top: 1px solid #e2e8f0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.design-element:hover .move-handle {
    opacity: 1;
}

.label-toggle-button {
    min-width: 32px;
    height: 28px;
    padding: 0 0.35rem;
}

.element-label {
    font-size: 0.85rem;
    color: #475569;
}

.element-body {
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
    margin-bottom: 0.35rem;
    line-height: 1.35;
    font-size: 1rem;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    border: 2px solid #ffffff;
    background: #2563eb;
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
    opacity: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.design-element:hover .resize-handle {
    opacity: 1;
}

.resize-handle:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.6);
}

.demo-drop {
    border: 1px dashed #d0d7e2;
    border-radius: 12px;
    padding: 0.75rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.demo-preview {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
}

.demo-preview__title {
    font-weight: 700;
    color: #0f172a;
}

.demo-preview__meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: #475569;
    font-size: 0.9rem;
}

.demo-price {
    background: #dbeafe;
    color: #2563eb;
    padding: 0.2rem 0.45rem;
    border-radius: 8px;
    font-weight: 700;
}

.demo-preview__empty {
    color: #94a3b8;
    font-weight: 600;
}

.layer-hint {
    color: #475569;
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.layer-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f9fafb;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease, background-color 0.2s ease;
}

.layer-item:hover {
    border-color: #2563eb;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.layer-item--active {
    border-color: #2563eb;
    background: #eef2ff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.14);
}

.layer-item--hidden {
    opacity: 0.6;
    background: #f1f5f9;
}

.layer-item__info {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.layer-item__order {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #2563eb;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.2);
}

.layer-item__labels {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    align-items: flex-start;
}

.layer-item__title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
}

.layer-item__meta {
    font-size: 0.8rem;
    color: #64748b;
}

.layer-item__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.layer-visibility {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 8px;
    padding: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.layer-visibility:hover {
    border-color: #2563eb;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
}

.color-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field-label {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
}

.emoji-grid,
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
    padding: 0.25rem;
}

.emoji-search {
    margin-bottom: 0.5rem;
}

.emoji-grid button,
.icon-grid button {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 12px;
    padding: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.emoji-grid button:hover,
.icon-grid button:hover {
    border-color: #2563eb;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.emoji-grid button.selected,
.icon-grid button.selected {
    border-color: #2563eb;
    background: #eef2ff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}

.icon-grid__label {
    font-size: 0.85rem;
    color: #334155;
}

.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.nutrition-table th,
.nutrition-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.nutrition-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #0f172a;
}

.nutrition-table tr:last-child td {
    border-bottom: none;
}

.design-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.element-upload input[type="file"] {
    font-size: 0.85rem;
}

.pattern-swatch {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 6px, #fef5eb 6px, #fef5eb 12px);
}

.pattern-dots {
    background-image: radial-gradient(#2563eb 1.5px, transparent 1.5px);
    background-size: 12px 12px;
    background-color: #eef2ff;
}

.pattern-stripes {
    background-image: linear-gradient(135deg, #c7d2fe 25%, transparent 25%), linear-gradient(225deg, #c7d2fe 25%, transparent 25%), linear-gradient(45deg, #c7d2fe 25%, transparent 25%), linear-gradient(315deg, #c7d2fe 25%, #eef2ff 25%);
    background-position: 10px 0, 10px 0, 0 0, 0 0;
    background-size: 10px 10px;
    background-repeat: repeat;
}

.pattern-grid {
    background-image: linear-gradient(#e5e7eb 1px, transparent 1px), linear-gradient(90deg, #e5e7eb 1px, transparent 1px);
    background-size: 16px 16px;
    background-color: #ffffff;
}

.pattern-wave {
    background: repeating-linear-gradient(90deg, #e0f2fe, #e0f2fe 6px, #bfdbfe 6px, #bfdbfe 12px);
}

.pattern-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.pattern-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pattern-button .pattern-preview {
    width: 48px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.pattern-button.selected {
    border-color: #2563eb;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.12);
    background: #eef2ff;
}

.designer-empty-alert {
    margin-top: 1rem;
}

.label-print-previews {
    position: fixed;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    pointer-events: none;
}
