/* Remove font-face declarations and start with body styles */
body {
    font-family: Arial, Georgia, 'Times New Roman', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #e5e5e5, #d0d0d0);
    color: #1a1a1a;
    display: flex;
    height: 100vh;
    overflow: hidden;
}
.container {
    display: flex;
    width: 100%;
    height: 100%;
}
.sidebar {
    width: 320px;
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    padding: 25px;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    border-radius: 0 12px 12px 0;
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
}
.sidebar h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 25px;
    color: #000000;
    letter-spacing: 1px;
}
.sidebar label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    color: #333333;
}
.sidebar label svg {
    margin-right: 8px;
    fill: #1a1a1a;
}
.sidebar select,
.sidebar input[type="number"]#labelCount {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: none;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #1a1a1a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}
.sidebar select {
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%231a1a1a" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}
.sidebar input[type="number"]#labelCount {
    width: 60px; /* Override width to match your inline style */
}
.sidebar select:focus,
.sidebar input[type="number"]#labelCount:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}
.sidebar button:not(.tool-btn, .settings-btn) {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.sidebar button:not(.tool-btn, .settings-btn):hover {
    transform: scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
    background: #0d0d0d;
}

/* Donate button styles */
.donate-btn-wrapper {
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: auto;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.donate-btn {
    background: linear-gradient(
        270deg,
        #ff6b6b,
        #c471ed,
        #ff9a9e,
        #c471ed,
        #ff6b6b
    ) !important;
    background-size: 300% 300% !important;
    animation: gradient-shift 8s ease infinite, heartbeat 3s ease-in-out infinite;
    border-radius: 25px !important;
    padding: 12px 28px !important;
    margin: 0 !important;
    font-size: 15px !important;
    width: auto !important;
    white-space: nowrap;
    transform-origin: center;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4),
                inset 0 -2px 10px rgba(255, 255, 255, 0.3),
                inset 0 2px 10px rgba(255, 255, 255, 0.4),
                0 0 20px rgba(255, 107, 107, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    position: relative;
    overflow: hidden;
    color: white !important;
}

.donate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: 0.8s;
}

.donate-btn:hover {
    animation: gradient-shift 8s ease infinite;
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.6),
                inset 0 -2px 10px rgba(255, 255, 255, 0.3),
                inset 0 2px 10px rgba(255, 255, 255, 0.4),
                0 0 30px rgba(255, 107, 107, 0.6) !important;
}

.donate-btn:hover::before {
    left: 100%;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4),
                    inset 0 -2px 10px rgba(255, 255, 255, 0.3),
                    inset 0 2px 10px rgba(255, 255, 255, 0.4),
                    0 0 20px rgba(255, 107, 107, 0.4);
    }
    25% {
        transform: scale(1.1);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.6),
                    inset 0 -2px 10px rgba(255, 255, 255, 0.3),
                    inset 0 2px 10px rgba(255, 255, 255, 0.4),
                    0 0 30px rgba(255, 107, 107, 0.6);
    }
    50% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4),
                    inset 0 -2px 10px rgba(255, 255, 255, 0.3),
                    inset 0 2px 10px rgba(255, 255, 255, 0.4),
                    0 0 20px rgba(255, 107, 107, 0.4);
    }
}

.tool-btn {
    width: 50px;
    height: 50px;
    background: #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.2s, transform 0.2s;
    margin: 0 10px;
}
.tool-btn:hover {
    background: #0d0d0d;
    transform: scale(1.05);
}
.tool-btn svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}
.tools {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.settings-btn {
    position: absolute;
    bottom: 25px;
    left: 25px;
    width: 40px;
    height: 40px;
    background: #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.2s, transform 0.2s;
}
.settings-btn:hover {
    background: #0d0d0d;
    transform: scale(1.05);
}
.settings-btn svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}
#mainPanel { display: block; }
#settingsPanel { display: none; }
#titleMain { display: block; }
#titleSettings { display: none; }
.preview-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #d9d9d9;
    position: relative;
    overflow: hidden;
}

.canvas-workspace {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#previewCanvas {
    border-radius: 10px;
    border: 1px solid #b3b3b3;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
#overlayCanvas {
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        padding: 20px;
    }
    .preview-container {
        height: 50%;
        padding: 15px;
    }
    #previewCanvas, #overlayCanvas {
        width: 100% !important;
        height: 100% !important;
    }
    .settings-btn {
        bottom: 15px;
        left: 15px;
    }
}
.delete-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ff0000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    color: #ffffff;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: background 0.2s, transform 0.2s;
    z-index: 100;
}
.delete-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal-content {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    width: 280px;
    text-align: center;
    font-family: Arial, Georgia, 'Times New Roman', sans-serif;
    position: relative;
    z-index: 2001;
}
.modal-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 15px;
}
.modal-content input {
    width: calc(100% - 24px);
    padding: 12px;
    margin-bottom: 20px;
    border: none;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #1a1a1a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.modal-content input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}
.modal-content button {
    padding: 12px 20px;
    margin: 0 10px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.modal-content .ok-btn {
    background: #1a1a1a;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.modal-content .ok-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
    background: #0d0d0d;
}
.modal-content .cancel-btn {
    background: #d9d9d9;
    color: #1a1a1a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.modal-content .cancel-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
    background: #c0c0c0;
}

/* ----- Print count modal (app-styled) ----- */
.print-count-modal {
    background: rgba(15, 23, 42, 0.45);
}
.print-count-modal .modal-content {
    background: #ffffff;
    border: 1px solid #e2e6ed;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 15, 18, 0.18), 0 1px 3px rgba(15, 15, 18, 0.08);
    padding: 22px 22px 18px;
    width: 320px;
    text-align: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.print-count-modal .print-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #e8edf5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: #0f0f12;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.print-count-modal .print-modal-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.print-count-modal h2 {
    font-size: 17px;
    font-weight: 600;
    color: #0f0f12;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}
.print-count-modal .print-modal-help {
    color: #3f3f46;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 16px;
}
.print-count-modal .print-count-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 18px;
}
.print-count-modal .print-count-step {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e2e6ed;
    background: #ffffff;
    color: #0f0f12;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, border-color 0.12s ease;
    margin: 0;
    padding: 0;
    box-shadow: none;
    line-height: 1;
}
.print-count-modal .print-count-step:hover {
    background: #f6f7fa;
    border-color: #cdd2dc;
    transform: none;
    box-shadow: none;
}
.print-count-modal #printCountInput {
    -webkit-appearance: none;
    appearance: none;
    -moz-appearance: textfield;
    width: 88px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #e2e6ed;
    background: #ffffff;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #0f0f12;
    text-align: center;
    margin: 0;
    box-shadow: none;
    font-family: inherit;
}
.print-count-modal #printCountInput:focus {
    outline: none;
    border-color: #18181b;
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}
.print-count-modal #printCountInput::-webkit-outer-spin-button,
.print-count-modal #printCountInput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.print-count-modal .print-modal-error {
    margin: -4px 0 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fef1f2;
    border: 1px solid #f5c0c5;
    color: #b42318;
    font-size: 12.5px;
    line-height: 1.4;
    text-align: left;
}
.print-count-modal .print-modal-error[hidden] { display: none; }

.print-count-modal .print-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.print-count-modal .print-modal-actions .ok-btn,
.print-count-modal .print-modal-actions .cancel-btn {
    margin: 0;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: none;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
    font-family: inherit;
}
.print-count-modal .print-modal-actions .cancel-btn {
    background: transparent;
    color: #71717a;
    font-weight: 500;
}
.print-count-modal .print-modal-actions .cancel-btn:hover {
    background: #f1f1f3;
    color: #18181b;
    transform: none;
    box-shadow: none;
}
.print-count-modal .print-modal-actions .ok-btn {
    background: #18181b;
    color: #fafafa;
    border-color: #18181b;
}
.print-count-modal .print-modal-actions .ok-btn:hover {
    background: #27272a;
    border-color: #27272a;
    transform: none;
    box-shadow: none;
}

/* ----- Preview mode (distraction-free) ----- */
.editor-shell.preview-mode .editor-header,
.editor-shell.preview-mode .left-rail,
.editor-shell.preview-mode .avnac-panel-wrap,
.editor-shell.preview-mode .float-toolbar-zone .floating-pill,
.editor-shell.preview-mode .float-toolbar-zone .grid-popover,
.editor-shell.preview-mode .float-toolbar-zone .color-popover,
.editor-shell.preview-mode .float-toolbar-zone .printer-settings-popover,
.editor-shell.preview-mode .selection-toolbar,
.editor-shell.preview-mode .shortcuts-strip,
.editor-shell.preview-mode .batch-navigator,
.editor-shell.preview-mode .batch-nav-edit-popover,
.editor-shell.preview-mode .variable-popover,
.editor-shell.preview-mode .help-popover,
.editor-shell.preview-mode .copy-feedback,
.editor-shell.preview-mode #overlayCanvas {
    display: none !important;
}
/* Keep editor-main / preview-container / canvas-workspace at their normal
   positions in preview mode so the zoom pill (anchored to preview-container's
   bottom-right) stays in exactly the same place. We only hide chrome — the
   canvas itself doesn't reflow. */
.editor-shell.preview-mode .preview-container {
    background: var(--bg);
}
/* Canvas elements aren't selectable / draggable in preview, but the
   workspace stays scrollable + scroll-wheel-zoomable because pointer-events
   only sits on the frame. */
.editor-shell.preview-mode .canvas-frame {
    pointer-events: none;
}
.editor-shell.preview-mode #previewModeBtn {
    background: var(--ink);
    color: var(--surface);
}

/* ----- Browser Print install modal ----- */
.browser-print-missing-modal {
    background: rgba(15, 23, 42, 0.55);
}
.browser-print-missing-modal[hidden] { display: none !important; }
.browser-print-missing-modal .modal-content {
    background: #ffffff;
    border: 1px solid #e2e6ed;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 15, 18, 0.18), 0 1px 3px rgba(15, 15, 18, 0.08);
    padding: 26px 26px 20px;
    width: 460px;
    max-width: calc(100vw - 32px);
    text-align: left;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.browser-print-missing-modal .print-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fef3c7;
    color: #92400e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 12px;
}
.browser-print-missing-modal .print-modal-icon svg {
    width: 22px; height: 22px;
    fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.browser-print-missing-modal h2 {
    font-size: 18px; font-weight: 600; color: #0f0f12; margin: 0 0 6px;
    letter-spacing: -0.01em; text-align: left;
}
.browser-print-missing-modal .print-modal-help {
    color: #3f3f46; font-size: 13.5px; line-height: 1.55; margin: 0 0 16px;
}
.bp-install-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.bp-install-grid.bp-install-grid-two {
    grid-template-columns: repeat(2, 1fr);
}
.bp-install-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    border: 1px solid #e2e6ed;
    border-radius: 10px;
    padding: 12px;
    background: #fafbfc;
    transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.bp-install-card:hover {
    background: #fff;
    border-color: #cdd2dc;
}
.bp-install-os {
    font-size: 12px; font-weight: 600; color: #0f0f12; letter-spacing: 0.02em; text-transform: uppercase;
}
.bp-install-cta { font-size: 12px; color: #2563eb; }
.bp-install-steps {
    margin: 0 0 16px;
    padding-left: 22px;
    color: #3f3f46;
    font-size: 13px;
    line-height: 1.6;
}
.bp-install-steps strong { color: #0f0f12; }
.browser-print-missing-modal .print-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}
.browser-print-missing-modal .print-modal-actions .ok-btn,
.browser-print-missing-modal .print-modal-actions .cancel-btn {
    margin: 0;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: none;
    font-family: inherit;
}
.browser-print-missing-modal .print-modal-actions .cancel-btn { background: transparent; color: #71717a; font-weight: 500; }
.browser-print-missing-modal .print-modal-actions .cancel-btn:hover { background: #f1f1f3; color: #18181b; transform: none; box-shadow: none; }
.browser-print-missing-modal .print-modal-actions .ok-btn { background: #18181b; color: #fafafa; border-color: #18181b; }
.browser-print-missing-modal .print-modal-actions .ok-btn:hover { background: #27272a; border-color: #27272a; transform: none; box-shadow: none; }
.copy-feedback {
    position: absolute;
    left: 50%;
    bottom: 50px;
    transform: translateX(-50%) translateY(8px);
    background: #18181b;
    color: #fafafa;
    border: 1px solid #18181b;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 15, 18, 0.07), 0 1px 3px rgba(15, 15, 18, 0.04));
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.copy-feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* When the batch row navigator is visible it sits at bottom: 50px —
   the same spot as the toast. Lift the toast above the navigator so
   the two pills stack vertically instead of overlapping. */
.editor-shell:has(.batch-navigator:not([hidden])) .copy-feedback {
    bottom: 104px;
}

/* Add styles for font size number input */
.sidebar input[type="number"]#fontSizeSelect {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: none;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #1a1a1a;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    appearance: textfield;
    -moz-appearance: textfield;
    box-sizing: border-box;
    display: block;
}

.sidebar input[type="number"]#fontSizeSelect::-webkit-inner-spin-button,
.sidebar input[type="number"]#fontSizeSelect::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    transition: all 0.2s ease;
    padding: 12px;
    box-sizing: border-box;
}

.checkbox-wrapper input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 0 10px 0 0;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: white;
}

.checkbox-wrapper input[type="checkbox"]:checked {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
}

.checkbox-wrapper input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    top: 2px;
}

.checkbox-wrapper label {
    font-size: 14px;
    color: #1a1a1a;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    height: 20px;
}

/* Mobile Access Restriction */
.mobile-warning {
    display: none;
    position: fixed;
    inset: 0;
    background: #ffffff;
    color: #0f0f12;
    z-index: 9999;
    padding: 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mobile-warning .mobile-warning-card {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    width: 100%;
    max-width: 440px;
    min-height: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
}

.mobile-warning .desktop-icon {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    background: #e8edf5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0f0f12;
    box-shadow:
        0 6px 16px rgba(15, 23, 42, 0.08),
        0 1px 2px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.mobile-warning .desktop-icon svg {
    width: 36px;
    height: 36px;
    stroke: currentColor;
    fill: none;
}

.mobile-warning h2 {
    font-size: 24px;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: #0f0f12;
    text-transform: none;
    line-height: 1.25;
}

.mobile-warning p {
    margin: 0;
    color: #3f3f46;
    font-size: 16px;
    line-height: 1.55;
    max-width: 360px;
}

.mobile-warning .mobile-warning-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 12px 22px;
    background: #18181b;
    color: #fafafa;
    border-radius: 999px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid #18181b;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    margin-top: 10px;
    box-shadow:
        0 6px 16px rgba(15, 23, 42, 0.18),
        0 1px 2px rgba(15, 23, 42, 0.10);
}

.mobile-warning .mobile-warning-back:hover {
    background: #27272a;
    border-color: #27272a;
    box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.22),
        0 2px 3px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

@media screen and (max-width: 900px) {
    .mobile-warning {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: #ffffff !important;
    }
    .container {
        display: none !important;
    }
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    inset: 0;
    background: #eef2f8;
    color: #0f0f12;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-screen .loading-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e6e6e9;
    box-shadow: 0 8px 24px rgba(15, 15, 18, 0.07), 0 1px 3px rgba(15, 15, 18, 0.04);
    padding: 8px;
    box-sizing: border-box;
    object-fit: contain;
    animation: loading-logo-pop 0.5s ease-out both;
}

.loading-screen h2 {
    font-size: 18px;
    line-height: 1.2;
    margin: 0;
    font-weight: 600;
    color: #0f0f12;
    letter-spacing: -0.01em;
}

.loading-screen .loading-progress {
    width: 240px;
    height: 4px;
    background: #ececef;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    margin-top: 8px;
}

.loading-screen .loading-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #18181b;
    width: 0%;
    transition: width 0.25s ease-out;
    border-radius: 999px;
}

.loading-screen .loading-text {
    font-size: 12px;
    color: #71717a;
    text-align: center;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

@keyframes loading-logo-pop {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@media screen and (max-width: 900px) {
    .loading-screen {
        display: none !important;
    }
}

/* Guided Tour Styles */
.guided-tour {
    position: fixed;
    inset: 0;
    z-index: 3000;
    pointer-events: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.tour-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    pointer-events: auto;
    transition: background 0.2s ease;
}
.guided-tour.tour-no-target .tour-overlay {
    background: rgba(15, 23, 42, 0.5);
}

.tour-highlight {
    position: fixed;
    background: transparent;
    border: 2px solid #2563eb;
    border-radius: 12px;
    box-shadow:
        0 0 0 9999px rgba(15, 23, 42, 0.55),
        0 0 0 4px rgba(37, 99, 235, 0.18);
    pointer-events: none;
    transition: top 0.25s cubic-bezier(.2, .8, .2, 1),
                left 0.25s cubic-bezier(.2, .8, .2, 1),
                width 0.25s cubic-bezier(.2, .8, .2, 1),
                height 0.25s cubic-bezier(.2, .8, .2, 1);
    z-index: 3001;
}

.tour-tooltip {
    position: fixed;
    background: #ffffff;
    color: #0f0f12;
    padding: 18px 18px 14px;
    border-radius: 14px;
    border: 1px solid #e2e6ed;
    box-shadow: 0 18px 40px rgba(15, 15, 18, 0.18), 0 1px 3px rgba(15, 15, 18, 0.08);
    width: 320px;
    max-width: calc(100vw - 32px);
    pointer-events: auto;
    z-index: 3002;
    transition: top 0.25s cubic-bezier(.2, .8, .2, 1),
                left 0.25s cubic-bezier(.2, .8, .2, 1);
}

.tour-tooltip .tour-step-label {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #71717a;
    margin: 0 0 6px;
}

.tour-tooltip h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
    color: #0f0f12;
    line-height: 1.3;
}

.tour-tooltip p {
    font-size: 13px;
    color: #3f3f46;
    line-height: 1.55;
    margin: 0 0 14px;
}

.tour-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.tour-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    box-shadow: none;
}

.tour-btn.tour-skip {
    background: transparent;
    color: #71717a;
    border-color: transparent;
    padding: 8px 12px;
}
.tour-btn.tour-skip:hover {
    color: #18181b;
    background: #f1f1f3;
}

.tour-btn.tour-next {
    background: #18181b;
    color: #fafafa;
    border-color: #18181b;
    font-weight: 600;
    padding: 9px 18px;
}
.tour-btn.tour-next:hover {
    background: #27272a;
    border-color: #27272a;
}

.tour-progress {
    display: flex;
    gap: 5px;
    align-items: center;
    flex: 1;
    justify-content: flex-start;
}

.tour-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4d4d8;
    transition: background 0.2s ease, transform 0.2s ease;
}

.tour-dot.active {
    background: #18181b;
    transform: scale(1.25);
}

.guided-tour.hidden { display: none; }

@media screen and (max-width: 900px) {
    .guided-tour {
        display: none !important;
    }
}

/* Tip Bar */
.tip-bar {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    text-align: center;
    color: #666;
    font-size: 12px;
}

.keyboard-shortcut {
    color: #ffd700;
    font-family: monospace;
}

/* ============================================================
   Avnac-style editor — design system
   ============================================================ */
.editor-shell {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    --bg: #eef2f8;
    --surface: #ffffff;
    --surface-2: #f6f7fa;
    --line: #e2e6ed;
    --line-strong: #cdd2dc;
    --ink: #0f0f12;
    --ink-2: #3f3f46;
    --ink-3: #71717a;
    --accent: #18181b;
    --accent-soft: #e8edf5;
    --shadow-sm: 0 1px 2px rgba(15, 15, 18, 0.04);
    --shadow-md: 0 8px 24px rgba(15, 15, 18, 0.07), 0 1px 3px rgba(15, 15, 18, 0.04);
    --shadow-lg: 0 18px 40px rgba(15, 15, 18, 0.10), 0 1px 3px rgba(15, 15, 18, 0.05);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --rail-w: 76px;
    --header-h: 56px;
    --shell-pad: 10px;

    position: fixed;
    inset: 0;
    display: block;
    background: var(--bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Re-enable text selection on editable fields so users can still type and
   select inside inputs, textareas, and contenteditable elements. */
.editor-shell input,
.editor-shell textarea,
.editor-shell [contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* hide legacy chrome inside the new shell */
.editor-shell #settingsPanel,
.editor-shell #titleMain,
.editor-shell #titleSettings,
.editor-shell .settings-btn,
.editor-shell .donate-btn-wrapper,
.editor-shell .avnac-panel-wrap > #titleMain,
.editor-shell .avnac-panel-wrap > #titleSettings,
.editor-shell .avnac-panel-wrap > .settings-btn,
.editor-shell .avnac-panel-wrap > .donate-btn-wrapper {
    display: none !important;
}

.hidden { display: none !important; }

/* ----- Avnac-style tooltips (using data-tooltip + data-tooltip-pos) ----- */
.editor-shell [data-tooltip] {
    position: relative;
}
.editor-shell [data-tooltip]::before,
.editor-shell [data-tooltip]::after {
    pointer-events: none;
    visibility: hidden;
    z-index: 200;
}
.editor-shell [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    background: #18181b;
    color: #fafafa;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    padding: 5px 8px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    letter-spacing: 0;
}
.editor-shell [data-tooltip]::before {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border: 4px solid transparent;
}
/* default placement: top */
.editor-shell [data-tooltip]:not([data-tooltip-pos])::after,
.editor-shell [data-tooltip][data-tooltip-pos="top"]::after {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}
.editor-shell [data-tooltip]:not([data-tooltip-pos])::before,
.editor-shell [data-tooltip][data-tooltip-pos="top"]::before {
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #18181b;
}
.editor-shell [data-tooltip][data-tooltip-pos="bottom"]::after {
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}
.editor-shell [data-tooltip][data-tooltip-pos="bottom"]::before {
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: #18181b;
}
/* Right-anchored variant: useful when a button sits near the viewport's
   right edge and a centered tooltip would overflow off-screen. */
.editor-shell [data-tooltip][data-tooltip-pos="bottom"][data-tooltip-align="end"]::after {
    left: auto;
    right: 0;
    transform: none;
}
.editor-shell [data-tooltip][data-tooltip-pos="bottom"][data-tooltip-align="end"]::before {
    left: auto;
    right: 12px;
    transform: none;
}
.editor-shell [data-tooltip][data-tooltip-pos="right"]::after {
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
}
.editor-shell [data-tooltip][data-tooltip-pos="right"]::before {
    left: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border-right-color: #18181b;
}
.editor-shell [data-tooltip][data-tooltip-pos="left"]::after {
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
}
.editor-shell [data-tooltip][data-tooltip-pos="left"]::before {
    right: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border-left-color: #18181b;
}
.editor-shell [data-tooltip]:hover::after,
.editor-shell [data-tooltip]:hover::before,
.editor-shell [data-tooltip]:focus-visible::after,
.editor-shell [data-tooltip]:focus-visible::before {
    visibility: visible;
    transition-delay: 0.25s;
}
/* When a side panel or the help popover is open, suppress right-pointing
   tooltips on the rail since the panel/popover sits over the area where
   they would appear. */
.editor-shell.panel-active .left-rail [data-tooltip][data-tooltip-pos="right"]:hover::after,
.editor-shell.panel-active .left-rail [data-tooltip][data-tooltip-pos="right"]:hover::before,
.editor-shell.panel-active .left-rail [data-tooltip][data-tooltip-pos="right"]:focus-visible::after,
.editor-shell.panel-active .left-rail [data-tooltip][data-tooltip-pos="right"]:focus-visible::before,
.editor-shell.help-active .left-rail [data-tooltip][data-tooltip-pos="right"]:hover::after,
.editor-shell.help-active .left-rail [data-tooltip][data-tooltip-pos="right"]:hover::before,
.editor-shell.help-active .left-rail [data-tooltip][data-tooltip-pos="right"]:focus-visible::after,
.editor-shell.help-active .left-rail [data-tooltip][data-tooltip-pos="right"]:focus-visible::before {
    visibility: hidden;
}

/* Drop the tooltip arrow (a 4px CSS triangle that renders as a tiny dark
   blob) AND the drop shadow on rail tooltips — just the floating label,
   nothing else. */
.editor-shell .left-rail [data-tooltip]::before {
    display: none !important;
}
.editor-shell .left-rail [data-tooltip]::after {
    box-shadow: none;
}

/* ----- Generic icon button used across the editor ----- */
.editor-shell .icon-btn {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex: 0 0 auto;
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
    padding: 0;
}
.editor-shell .icon-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    /* Stroke-only icons (lock, trash) have hollow centers. Default SVG
       pointer-events is visiblePainted, so those holes click through to
       the canvas and the button never fires. */
    pointer-events: none;
}
.editor-shell .icon-btn:hover {
    background: var(--accent-soft);
    color: var(--ink);
}
.editor-shell .icon-btn.active {
    background: var(--ink);
    color: #fff;
}
.editor-shell .icon-btn[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--ink);
}

/* ----- Left rail (floating) ----- */
.editor-shell .left-rail {
    position: fixed;
    left: calc(var(--shell-pad) + 10px);
    /* Shift the vertical center down ~30px from the viewport midline so
       there's an obvious breathing gap between the rail's top edge and
       the header bar — and so the rail visually leans toward the
       canvas's working area rather than the page chrome. */
    top: calc(50% + 30px);
    bottom: auto;
    width: var(--rail-w);
    /* Cap height so the rail's top edge never crosses the header.
       With a 30px downward shift, max-height = 100vh - 152px keeps the
       top edge at ~106px on any viewport (header sits at y=10–66, so
       ~40px clearance). On short screens the inner tools scroll. */
    max-height: calc(100vh - 152px);
    transform: translateY(-50%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    box-shadow: var(--shadow-md);
    z-index: 28;
    min-height: 0;
}

.editor-shell .rail-brand { display: none; }

.editor-shell .rail-divider {
    height: 1px;
    background: var(--line);
    margin: 6px 8px;
    align-self: stretch;
}

.editor-shell .rail-spacer {
    /* Legacy element kept for safety — replaced by .rail-footer in the new
       layout, but harmless if it ever shows up. */
    flex: 0 0 6px;
    min-height: 6px;
}

/* Scrollable middle (Text → Layers) — invisible scrollbar, with optional
   fade gradients at top/bottom edges driven by JS data-fade-* attributes. */
.editor-shell .rail-scroll {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.editor-shell .rail-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }
.editor-shell .rail-scroll[data-fade-top="true"][data-fade-bottom="true"] {
    mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}
.editor-shell .rail-scroll[data-fade-top="true"]:not([data-fade-bottom="true"]) {
    mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
}
.editor-shell .rail-scroll:not([data-fade-top="true"])[data-fade-bottom="true"] {
    mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent 100%);
}

/* Pinned footer at the rail's bottom — never scrolls. */
.editor-shell .rail-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    flex: 0 0 auto;
    padding-top: 6px;
    margin-top: 6px;
    border-top: 1px solid var(--line);
}

.editor-shell .rail-btn {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    width: 100%;
    max-width: 62px;
    border-radius: 16px;
    padding: 6px 4px 7px;
    color: var(--ink-3);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: color 0.15s ease;
}
.editor-shell .rail-btn svg {
    width: 20px;
    height: 20px;
    padding: 8px;
    border-radius: 50%;
    box-sizing: content-box;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    background: transparent;
    transition: background 0.15s ease;
}
.editor-shell .rail-btn:hover { color: var(--ink); }
.editor-shell .rail-btn:hover svg { background: var(--accent-soft); }
.editor-shell .rail-btn:active svg { transform: scale(0.94); }
.editor-shell .rail-btn.active { color: var(--ink); }
.editor-shell .rail-btn.active svg { background: #ececef; }

/* Support button — solid red heart. */
.editor-shell .rail-btn.rail-support {
    color: #e11d48;
}
.editor-shell .rail-btn.rail-support svg {
    fill: #e11d48;
    stroke: #e11d48;
}
.editor-shell .rail-btn.rail-support:hover {
    color: #be123c;
}
.editor-shell .rail-btn.rail-support:hover svg {
    fill: #be123c;
    stroke: #be123c;
    background: rgba(225, 29, 72, 0.10);
}

/* ----- Editor main column ----- */
.editor-shell .editor-main {
    position: fixed;
    top: calc(var(--shell-pad) + var(--header-h) + var(--shell-pad));
    left: calc(var(--shell-pad) + var(--rail-w) + 0px);
    right: var(--shell-pad);
    bottom: var(--shell-pad);
    display: block;
}

/* ----- Header (floating) ----- */
.editor-shell .editor-header {
    position: fixed;
    top: var(--shell-pad);
    left: var(--shell-pad);
    right: var(--shell-pad);
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: 30;
}
.editor-shell .editor-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.editor-shell .home-tile {
    -webkit-appearance: none;
    appearance: none;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-2);
    cursor: pointer;
    box-shadow: none;
    flex-shrink: 0;
    text-decoration: none;
    transition: background 0.12s ease;
}
.editor-shell .home-tile:hover { background: var(--accent-soft); color: var(--ink); }
.editor-shell .home-tile svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.editor-shell .brand-wordmark {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
    user-select: none;
    margin-left: 2px;
    display: none;
    text-decoration: none;
    transition: color 0.12s ease;
}
.editor-shell a.brand-wordmark:hover { color: #27272a; }
.editor-shell .header-divider {
    width: 1px;
    height: 18px;
    background: var(--line);
    margin: 0 4px;
    display: none;
}

.editor-shell .document-name-input {
    border: 1px solid transparent;
    background: transparent;
    font-size: 16px;
    color: #8c8c93;
    outline: none;
    font-weight: 600;
    letter-spacing: -0.005em;
    width: 280px;
    padding: 8px 13px;
    border-radius: 8px;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95),
        0 -1px 0 rgba(15, 15, 18, 0.06);
    transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.editor-shell .document-name-input:hover {
    background: transparent;
    border-color: transparent;
    color: #6e6e75;
}
.editor-shell .document-name-input:focus {
    background: transparent;
    border-color: transparent;
    color: var(--ink);
    text-shadow: none;
}
.editor-shell .document-name-input::placeholder {
    color: #a8a8af;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95),
        0 -1px 0 rgba(15, 15, 18, 0.05);
    font-weight: 500;
}

.editor-shell .editor-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-shell .file-group,
.editor-shell .export-group {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-shell .header-pill {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-pill);
    padding: 7px 16px 7px 13px;
    font-size: 15px;
    color: var(--ink);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: none;
    height: 42px;
    transition: background 0.12s, border-color 0.12s;
}
.editor-shell .header-pill svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .header-pill:hover {
    background: var(--surface-2);
}

.editor-shell .header-icon-btn {
    -webkit-appearance: none;
    appearance: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.12s, color 0.12s;
}
.editor-shell .header-icon-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .header-icon-btn:hover { color: var(--ink); }

.editor-shell .export-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #fafafa;
    border-radius: var(--radius-pill);
    padding: 8px 18px 8px 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    box-shadow: none;
    transition: background 0.12s, transform 0.12s;
}
.editor-shell .export-btn:hover { background: #27272a; border-color: #27272a; }
.editor-shell .export-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .artboard-toolbar .artboard-print-btn {
    margin-left: 8px;
}

.editor-shell .header-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 320px;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 60;
}
.editor-shell .header-menu.header-menu-right { left: auto; right: 0; }

.editor-shell .header-menu-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    padding: 6px 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.editor-shell .header-menu-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 240px;
    overflow-y: auto;
}
#savedDesignsList {
    overflow: visible;
    max-height: none;
}

.editor-shell .header-menu-empty {
    font-size: 12px;
    color: var(--ink-3);
    padding: 8px 10px;
}

.editor-shell .header-menu-divider {
    height: 1px;
    background: var(--line);
    margin: 6px 4px;
}

.editor-shell .header-menu-action,
.editor-shell .header-menu-item {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
    box-shadow: none;
}
.editor-shell .header-menu-action svg,
.editor-shell .header-menu-item svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--ink-3);
    flex-shrink: 0;
}
.editor-shell .header-menu-action:hover,
.editor-shell .header-menu-item:hover { background: var(--accent-soft); }
.editor-shell .header-menu-item.active { background: var(--accent-soft); }
.editor-shell .header-menu-item .item-meta {
    margin-left: auto;
    color: var(--ink-3);
    font-size: 11px;
}
.editor-shell .header-menu-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
}
.editor-shell .header-menu-item-row.active {
    background: var(--accent-soft);
}
.editor-shell .header-menu-item-row:hover {
    background: var(--accent-soft);
}
.editor-shell .header-menu-item-row .header-menu-item {
    flex: 1;
    min-width: 0;
}
.editor-shell .header-menu-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding-right: 4px;
}
.editor-shell .header-menu-item-icon {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    width: 28px;
    height: 28px;
    border-radius: 999px !important;
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
    transition: background 0.12s, color 0.12s;
}
.editor-shell .header-menu-item-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .header-menu-item-icon:hover {
    background: transparent;
    color: #60a5fa;
    border-radius: 999px !important;
}
.editor-shell .header-menu-item-icon.danger:hover {
    background: transparent;
    color: #f87171;
    border-radius: 999px !important;
}

/* ----- Floating toolbar zone (artboard / element formatting) ----- */
.editor-shell .float-toolbar-zone {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 45;
}
.editor-shell .floating-pill {
    pointer-events: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 5px 8px;
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 44px;
    max-width: calc(100vw - var(--rail-w) - 4 * var(--shell-pad));
}
.editor-shell.panel-open .floating-pill {
    max-width: calc(100vw - var(--rail-w) - 320px - 4 * var(--shell-pad));
}
.editor-shell .pill-divider {
    width: 1px;
    height: 22px;
    background: var(--line);
    margin: 0 2px;
    flex: 0 0 auto;
}
.editor-shell .pill-label {
    font-size: 12px;
    color: var(--ink-3);
    padding-left: 6px;
}
.editor-shell .pill-select {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    padding: 6px 22px 6px 8px;
    border-radius: 8px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%2371717a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px;
    font-family: inherit;
    min-width: 0;
}
.editor-shell .pill-select.short { min-width: 96px; max-width: 140px; }
.editor-shell .pill-select:hover { background-color: var(--accent-soft); }
.editor-shell .pill-select.hidden-native {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    pointer-events: none;
    opacity: 0;
}

/* ----- Custom pill picker (printer / label size) ----- */
.editor-shell .pill-trigger {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    height: 32px;
    padding: 0 8px 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
    box-shadow: none;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 220px;
}
.editor-shell .pill-trigger:hover {
    background: var(--accent-soft);
}
.editor-shell .pill-trigger[aria-expanded="true"] {
    background: var(--accent-soft);
    border-color: var(--line);
}
.editor-shell .pill-trigger-icon {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--ink-2);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}
.editor-shell .pill-trigger-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.editor-shell .pill-trigger-chev {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: var(--ink-3);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
    transition: transform 0.18s ease;
}
.editor-shell .pill-trigger[aria-expanded="true"] .pill-trigger-chev {
    transform: rotate(180deg);
}

/* ----- Picker popover (used by pill-trigger and elsewhere) ----- */
.picker-popover {
    position: fixed;
    background: var(--surface, #fff);
    border: 1px solid var(--line, #e6e6e9);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 15, 18, 0.10), 0 1px 3px rgba(15, 15, 18, 0.05);
    padding: 6px;
    min-width: 240px;
    max-width: 360px;
    max-height: 360px;
    z-index: 80;
    display: none;
    flex-direction: column;
    gap: 4px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink, #18181b);
    transform-origin: top center;
    animation: picker-pop-in 0.14s ease;
}
@keyframes picker-pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes help-popover-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.picker-popover.open { display: flex; }
.picker-popover .picker-search {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line, #e6e6e9);
    background: var(--surface-2, #fafafa);
    border-radius: 10px;
    padding: 8px 10px 8px 32px;
    font-size: 13px;
    color: inherit;
    outline: none;
    margin: 4px 4px 6px;
    font-family: inherit;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%2371717a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 13px;
}
.picker-popover .picker-search:focus {
    border-color: var(--ink, #18181b);
    background-color: #fff;
}
.picker-popover .picker-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px;
    max-height: 280px;
    scrollbar-width: thin;
}
.picker-popover .picker-list::-webkit-scrollbar { width: 8px; }
.picker-popover .picker-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.10); border-radius: 999px; }
.picker-popover .picker-item {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.1s;
    font-family: inherit;
    font-weight: 500;
}
.picker-popover .picker-item:hover,
.picker-popover .picker-item.focused {
    background: var(--accent-soft, #f4f4f5);
}
.picker-popover .picker-item.selected {
    background: var(--accent-soft, #f4f4f5);
}
.picker-popover .picker-item .check {
    margin-left: auto;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--ink, #18181b);
    opacity: 0;
}
.picker-popover .picker-item.selected .check { opacity: 1; }
.picker-popover .picker-item .item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
}
.picker-popover .picker-item .item-meta {
    color: var(--ink-3, #71717a);
    font-size: 11px;
    font-weight: 500;
    margin-left: 6px;
    flex: 0 0 auto;
}
.picker-popover .picker-empty {
    padding: 14px 10px;
    text-align: center;
    color: var(--ink-3, #71717a);
    font-size: 12px;
}

/* ----- Inline input popover (barcode / QR add) ----- */
.inline-input-popover {
    position: fixed;
    background: var(--surface, #fff);
    border: 1px solid var(--line, #e6e6e9);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 15, 18, 0.10), 0 1px 3px rgba(15, 15, 18, 0.05);
    padding: 12px 12px 10px;
    width: 304px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink, #18181b);
    transform-origin: top left;
    animation: picker-pop-in 0.16s ease;
}
.inline-input-popover[hidden] { display: none !important; }
.inline-input-popover .iip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 2px;
}
.inline-input-popover .iip-icon {
    width: 24px;
    height: 24px;
    padding: 5px;
    border-radius: 7px;
    background: var(--accent-soft, #f4f4f5);
    fill: none;
    stroke: var(--ink, #18181b);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
    box-sizing: border-box;
}
.inline-input-popover .iip-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink, #18181b);
    flex: 1 1 auto;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.inline-input-popover .iip-close {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    color: var(--ink-3, #71717a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
    transition: background 0.12s, color 0.12s;
}
.inline-input-popover .iip-close:hover {
    background: var(--accent-soft, #f4f4f5);
    color: var(--ink, #18181b);
}
.inline-input-popover .iip-close svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.inline-input-popover .iip-input {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line, #e6e6e9);
    background: var(--surface, #fff);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: inherit;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.12s, box-shadow 0.12s;
    height: 34px;
    line-height: 1.2;
}
.inline-input-popover .iip-input:hover {
    border-color: var(--line-strong, #d4d4d8);
}
.inline-input-popover .iip-input:focus {
    border-color: var(--ink, #18181b);
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}
.inline-input-popover .iip-input::placeholder {
    color: var(--ink-3, #a1a1aa);
}
.inline-input-popover .iip-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ink-2, #3f3f46);
    cursor: pointer;
    user-select: none;
    padding: 0 2px;
}
.inline-input-popover .iip-checkbox[hidden] { display: none !important; }
.inline-input-popover .iip-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border: 1px solid var(--line-strong, #d4d4d8);
    background: var(--surface, #fff);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    margin: 0;
    transition: all 0.12s ease;
    flex: 0 0 auto;
}
.inline-input-popover .iip-checkbox input[type="checkbox"]:checked {
    background: var(--ink, #18181b);
    border-color: var(--ink, #18181b);
}
.inline-input-popover .iip-checkbox input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.inline-input-popover .iip-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 2px;
}
.inline-input-popover .iip-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line, #e6e6e9);
    background: var(--surface, #fff);
    border-radius: 999px !important;
    padding: 7px 16px 7px 13px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink, #18181b);
    cursor: pointer;
    font-family: inherit;
    box-shadow: none;
    transition: background 0.12s, border-color 0.12s;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
}
.inline-input-popover .iip-actions .iip-btn {
    border-radius: 999px !important;
}
.inline-input-popover .iip-btn.iip-cancel:hover {
    background: var(--surface-2, #f4f4f5);
    border-color: var(--line, #e6e6e9);
}
.inline-input-popover .iip-btn.iip-primary {
    background: var(--ink, #18181b);
    color: #fafafa;
    border-color: var(--ink, #18181b);
    font-weight: 600;
    padding: 8px 18px 8px 14px;
}
.inline-input-popover .iip-btn.iip-primary:hover {
    background: #27272a;
    border-color: #27272a;
}

.editor-shell .pill-num {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 8px;
    padding: 5px 6px;
    width: 56px;
    text-align: center;
    font-size: 13px;
    color: var(--ink);
    font-family: inherit;
}
.editor-shell .pill-num::-webkit-inner-spin-button,
.editor-shell .pill-num::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Font-size stepper: − [input] + */
.editor-shell .font-size-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
    height: 30px;
}
.editor-shell .font-size-stepper .pill-num {
    border: none;
    border-radius: 0;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    width: 44px;
    height: 100%;
    padding: 0 4px;
    background: transparent;
    -moz-appearance: textfield;
    -webkit-appearance: none;
}
.editor-shell .font-size-stepper .pill-num:focus {
    outline: none;
    box-shadow: inset 0 0 0 1.5px var(--ink);
}
.editor-shell .font-size-step {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    width: 26px;
    height: 100%;
    padding: 0;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: var(--ink-2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease;
}
.editor-shell .font-size-step:hover {
    background: var(--accent-soft);
    color: var(--ink);
}
.editor-shell .font-size-step:active {
    background: #ececef;
}

/* ----- Preview / canvas area ----- */
.editor-shell .preview-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.editor-shell .canvas-workspace {
    position: absolute;
    top: 68px;
    left: 8px;
    right: 8px;
    bottom: 68px;
    overflow: auto;
    display: flex;
    /* `safe center` keeps the canvas centered while it fits and switches to
       start alignment once it overflows, so the top/left edge stays
       reachable when scrolling at high zoom. */
    align-items: safe center;
    justify-content: safe center;
    border-radius: var(--radius-md);
}
/* Fallback for browsers that ignore `safe center`: give the canvas frame
   auto margins so an overflowing canvas still scrolls from the start. */
.editor-shell .canvas-workspace > .canvas-frame {
    margin: auto;
}
.editor-shell .canvas-frame {
    position: relative;
    transform-origin: center center;
    flex-shrink: 0;
}
.editor-shell #previewCanvas {
    display: block;
    border-radius: 6px;
    border: none;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0;
}
.editor-shell #overlayCanvas {
    display: block;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    pointer-events: none;
    margin: 0;
}

.editor-shell .tip-bar { display: none; }
.editor-shell ~ .delete-btn,
body > .delete-btn { display: none !important; }

/* ----- Selection toolbar (above selected element) ----- */
.editor-shell .selection-toolbar {
    position: absolute;
    z-index: 90;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    padding: 4px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    pointer-events: auto;
}
.editor-shell .selection-toolbar .icon-btn {
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

/* ----- Zoom pill (bottom-right of preview) ----- */
.editor-shell .zoom-pill {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 3px 6px;
    height: 36px;
    box-shadow: var(--shadow-sm);
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.editor-shell .zoom-pill .icon-btn { width: 26px; height: 26px; border-radius: 7px; }
.editor-shell .zoom-pill .icon-btn svg { width: 13px; height: 13px; }
.editor-shell .zoom-pill input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 56px;
    height: 3px;
    background: #d4d4d8;
    border-radius: 999px;
    outline: none;
    margin: 0 2px;
}
.editor-shell .zoom-pill input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 11px;
    height: 11px;
    background: var(--ink);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line-strong);
}
.editor-shell .zoom-percent {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    font-size: 12px;
    color: var(--ink-2);
    min-width: 38px;
    text-align: center;
    padding: 0 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    border-radius: 6px;
    height: 26px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.editor-shell .zoom-percent::selection { background: transparent; color: inherit; }
.editor-shell .zoom-percent::-moz-selection { background: transparent; color: inherit; }
.editor-shell .zoom-percent:hover { color: var(--ink); background: var(--accent-soft); }

/* Help popover (anchored via JS to #railHelpBtn; avoid static left/top — flex static position sat in preview and read as “Layers height”) */
.editor-shell .help-popover {
    position: fixed;
    left: 0;
    top: 0;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: var(--shadow-md);
    font-size: 12px;
    line-height: 1.5;
    width: 268px;
    z-index: 50;
    animation: help-popover-in 0.14s ease-out;
    overflow: hidden;
}
.editor-shell .help-popover strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--line);
    margin: 0;
}
.editor-shell .help-popover p {
    margin: 0;
    color: var(--ink-2);
    display: block;
    padding: 9px 12px;
    font-size: 12px;
    border-bottom: 1px solid var(--line);
}
.editor-shell .help-popover p:last-child { border-bottom: none; }
.editor-shell .help-popover .help-contact {
    background: var(--surface-2);
    color: var(--ink);
}
.editor-shell .help-popover .help-contact a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.editor-shell .help-popover .help-contact a:hover {
    color: #27272a;
}

/* ----- Shortcuts strip (bottom-center, embossed text only) ----- */
/* ----- Batch row navigator (below canvas, above shortcuts strip) ----- */
.editor-shell .batch-navigator {
    position: absolute;
    left: 50%;
    bottom: 50px;
    transform: translateX(-50%);
    z-index: 36;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    padding: 4px 8px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: calc(100% - 32px);
}
.editor-shell .batch-navigator[hidden] { display: none !important; }
.editor-shell .batch-navigator .icon-btn { width: 26px; height: 26px; border-radius: 7px; }
.editor-shell .batch-navigator .icon-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.editor-shell .batch-navigator .batch-nav-step:disabled { color: var(--ink-3); cursor: not-allowed; opacity: 0.5; }
.editor-shell .batch-nav-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    padding: 0 6px;
    min-width: 80px;
    text-align: center;
    white-space: nowrap;
}
.editor-shell .batch-nav-range {
    -webkit-appearance: none;
    appearance: none;
    width: 140px;
    height: 3px;
    background: var(--line-strong);
    border-radius: 999px;
    outline: none;
    margin: 0 4px;
}
.editor-shell .batch-nav-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--ink);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line-strong);
}
.editor-shell .batch-nav-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--ink);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line-strong);
}
.editor-shell .batch-nav-text-btn {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--ink-2);
    padding: 5px 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 7px;
    margin: 0;
    box-shadow: none;
    transition: background 0.12s, color 0.12s;
}
.editor-shell .batch-nav-text-btn:hover {
    background: var(--accent-soft);
    color: var(--ink);
}
.editor-shell .batch-nav-text-btn.active {
    background: var(--ink);
    color: var(--surface);
}

/* Edit-row popover (one input per column, live-updates canvas) */
.editor-shell .batch-nav-edit-popover {
    position: fixed;
    z-index: 80;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    width: 320px;
    max-height: min(60vh, 460px);
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}
.editor-shell .batch-nav-edit-popover.hidden { display: none !important; }
.editor-shell .batch-nav-edit-popover .bne-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 4px;
}
.editor-shell .batch-nav-edit-popover .bne-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.editor-shell .batch-nav-edit-popover .bne-key {
    flex: 0 0 100px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 11.5px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-shell .batch-nav-edit-popover .bne-input {
    flex: 1 1 auto;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    padding: 5px 8px;
    font-family: inherit;
    font-size: 12px;
    color: var(--ink);
    outline: none;
    min-width: 0;
    box-sizing: border-box;
}
.editor-shell .batch-nav-edit-popover .bne-input:focus {
    border-color: var(--ink-2);
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}
.editor-shell .batch-nav-edit-popover .bne-empty {
    color: var(--ink-3);
    font-size: 12px;
    font-style: italic;
    padding: 8px 0;
}

.editor-shell .shortcuts-strip {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 18px;
    color: #8c8c93;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.005em;
    line-height: 1;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    max-width: calc(100% - 360px);
    overflow: hidden;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95),
        0 -1px 0 rgba(15, 15, 18, 0.06);
}
.editor-shell .shortcuts-strip span {
    display: inline-flex;
    align-items: center;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    pointer-events: none;
}
.editor-shell .shortcuts-strip ::selection { background: transparent; color: inherit; }
.editor-shell .shortcuts-strip ::-moz-selection { background: transparent; color: inherit; }
@media (max-width: 1200px) {
    .editor-shell .shortcuts-strip { display: none; }
}

/* ----- Side panel (Layers/Images) ----- */
.editor-shell .avnac-panel-wrap {
    position: fixed;
    /* 30px past the rail so there's a clear gap between the toolbox and
       the panel — same visual breathing room the Options menu has below
       its trigger button. */
    left: calc(var(--shell-pad) + var(--rail-w) + 30px);
    top: calc(var(--shell-pad) + var(--header-h) + var(--shell-pad));
    bottom: var(--shell-pad);
    width: 248px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    z-index: 26;
    padding: 0;
    display: none;
    overflow: hidden;
    flex-direction: column;
    z-index: 40;
}
.editor-shell .avnac-panel-wrap.layers-compact {
    bottom: auto;
    max-height: min(56vh, 440px);
}
.editor-shell .avnac-panel-wrap.layers-popover {
    left: calc(var(--shell-pad) + var(--rail-w) + 30px);
    bottom: auto;
    width: 268px;
    max-height: min(62vh, 460px);
}

/* Shift content when side panel is open so canvas/toolbar/help don't hide behind it. */
.editor-shell.panel-open .canvas-workspace { left: calc(248px + 30px + 16px); }
.editor-shell.panel-open .float-toolbar-zone { left: calc(248px + 30px + 8px); }
/* Reset legacy .sidebar button styling for our redesigned panels */
.editor-shell .avnac-panel-wrap button {
    background: transparent;
    color: inherit;
    box-shadow: none;
    transform: none;
    width: auto;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    font-weight: inherit;
    font-size: inherit;
}
.editor-shell .avnac-panel-wrap button:hover {
    transform: none;
    box-shadow: none;
    background: transparent;
}
.editor-shell .avnac-panel-wrap .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}
.editor-shell .avnac-panel-wrap .icon-btn:hover {
    background: var(--accent-soft);
}
.editor-shell .avnac-panel-wrap .panel-cta {
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    color: var(--ink);
    padding: 22px 12px;
    border-radius: 12px;
    margin-bottom: 0;
}
.editor-shell .avnac-panel-wrap .panel-cta:hover {
    background: var(--accent-soft);
    border-color: var(--ink-3);
}
.editor-shell .avnac-panel-wrap.open { display: flex; }
.editor-shell .avnac-panel-wrap > .sidebar { display: contents; }

.editor-shell .avnac-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 6px;
    border-bottom: 1px solid var(--line);
}
.editor-shell .avnac-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.editor-shell .avnac-panel {
    display: none;
    padding: 8px 10px 10px;
    overflow-y: auto;
    flex: 1;
}
.editor-shell .avnac-panel.active { display: block; }

.editor-shell .panel-help {
    color: var(--ink-3);
    font-size: 12px;
    margin: 0 0 10px;
    line-height: 1.5;
}
.editor-shell .panel-empty {
    color: var(--ink-3);
    font-size: 12px;
    text-align: center;
    padding: 24px 12px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    margin-top: 8px;
}
.editor-shell .panel-cta {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    border: 1px dashed var(--line-strong);
    background: var(--surface-2);
    color: var(--ink);
    border-radius: 12px;
    padding: 22px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: none;
    margin-bottom: 0;
    transition: background 0.12s, border-color 0.12s;
}
.editor-shell .panel-cta svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--ink-2);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .panel-cta:hover {
    background: var(--accent-soft);
    border-color: var(--ink-3);
}

/* ----- Panel form (barcode/QR side panels) ----- */
.editor-shell .panel-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
/* Input + inline action button (variable inserter on barcode / QR panels). */
.editor-shell .panel-field.panel-field-with-action {
    position: relative;
    display: block;
    margin-bottom: 12px;
}
.editor-shell .panel-field.panel-field-with-action .panel-input {
    padding-right: 40px;
}
.editor-shell .panel-field-action {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    /* Input is 36px tall; button is 28px → vertical-center inside the input
       (the field has no other content, so this is the only axis we need). */
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-3);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    padding: 0;
    margin: 0;
    box-shadow: none;
    line-height: 0;
}
.editor-shell .panel-field-action svg {
    display: block;
    width: 16px; height: 16px;
    fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.editor-shell .panel-field-action:hover,
.editor-shell .panel-field-action.active {
    background: var(--accent-soft);
    border-color: var(--line);
    color: var(--ink);
}
.editor-shell #panel-barcode .panel-field + .panel-field {
    margin-top: -6px;
}
.editor-shell .panel-field label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--ink-2);
    letter-spacing: 0.01em;
}
.editor-shell .panel-input {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--ink);
    outline: none;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.12s, box-shadow 0.12s;
    height: 36px;
    line-height: 1.2;
}
.editor-shell .panel-input:hover { border-color: var(--line-strong); }
.editor-shell .panel-input:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}
.editor-shell .panel-input::placeholder { color: var(--ink-3); }
.editor-shell select.panel-input {
    cursor: pointer;
    padding-right: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%2371717a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}
.editor-shell select.panel-input:hover {
    background-color: var(--accent-soft);
}

.editor-shell .panel-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
    user-select: none;
    margin-bottom: 12px;
}
.editor-shell .panel-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    margin: 0;
    transition: background 0.12s, border-color 0.12s;
    flex: 0 0 auto;
}
.editor-shell .panel-checkbox input[type="checkbox"]:checked {
    background: var(--ink);
    border-color: var(--ink);
}
.editor-shell .panel-checkbox input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.editor-shell .avnac-panel-wrap .panel-primary {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #fafafa;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
    height: 38px;
    box-shadow: none;
}
.editor-shell .avnac-panel-wrap .panel-primary:hover {
    background: #27272a;
    border-color: #27272a;
}

/* ----- Layers list ----- */
.editor-shell .layers-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.editor-shell .layer-row {
    display: grid;
    grid-template-columns: 20px 1fr auto auto;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.editor-shell .layer-row:hover { background: var(--accent-soft); }
.editor-shell .layer-row.active {
    background: var(--accent-soft);
    border-color: var(--line-strong);
}
.editor-shell .layer-row.dragging {
    opacity: 0.5;
    cursor: grabbing;
}
.editor-shell .layer-row.drop-above {
    box-shadow: inset 0 2px 0 0 #2563eb;
}
.editor-shell .layer-row.drop-below {
    box-shadow: inset 0 -2px 0 0 #2563eb;
}
.editor-shell .layer-row .layer-glyph {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.editor-shell .layer-row .layer-glyph svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .layer-row .layer-name {
    font-size: 12px;
    color: var(--ink);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.editor-shell .layer-row .layer-icon-btn {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
    margin: 0;
    font-size: 12px;
}
.editor-shell .layer-row .layer-icon-btn svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .layer-row .layer-icon-btn:hover { background: var(--surface); color: var(--ink); }
.editor-shell .layer-row .layer-icon-btn.active {
    background: var(--ink);
    color: #fafafa;
}
.editor-shell .layer-row .layer-icon-btn.active:hover {
    background: #27272a;
    color: #fafafa;
}
.editor-shell .layer-row .layer-icon-btn.active svg {
    stroke: currentColor;
}

/* ----- Label setup panel (re-skin legacy mainPanel inside Label tab) ----- */
.editor-shell #mainPanel {
    display: block !important;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.editor-shell #panel-label #mainPanel label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 12px 0 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.editor-shell #panel-label #mainPanel label svg {
    width: 12px;
    height: 12px;
    margin: 0;
    fill: var(--ink-3);
}

.editor-shell #panel-label #mainPanel select,
.editor-shell #panel-label #mainPanel input[type="number"] {
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: none;
    font-size: 13px;
    color: var(--ink);
    font-family: inherit;
    box-sizing: border-box;
}

.editor-shell #panel-label #mainPanel .tools {
    justify-content: flex-start;
    margin: 12px 0 8px;
    gap: 8px;
    display: flex;
    flex-wrap: wrap;
}
.editor-shell #panel-label #mainPanel .tool-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: none;
    margin: 0;
}
.editor-shell #panel-label #mainPanel .tool-btn svg {
    width: 18px;
    height: 18px;
    fill: var(--ink);
}
.editor-shell #panel-label #mainPanel .tool-btn:hover {
    background: var(--accent-soft);
    transform: none;
}

.editor-shell #panel-label #mainPanel > button:not(.tool-btn) {
    width: 100%;
    margin: 6px 0 0;
    border-radius: 10px;
    box-shadow: none;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 10px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    transform: none;
}
.editor-shell #panel-label #mainPanel > button:not(.tool-btn):hover {
    background: var(--accent-soft);
    transform: none;
    box-shadow: none;
}

/* hide typography controls in Label panel — those live in floating toolbar */
.editor-shell #panel-label #mainPanel label:nth-of-type(3),
.editor-shell #panel-label #mainPanel label:nth-of-type(4),
.editor-shell #panel-label #mainPanel label:nth-of-type(5),
.editor-shell #panel-label #mainPanel #fontFamilySelect,
.editor-shell #panel-label #mainPanel #fontSizeSelect,
.editor-shell #panel-label #mainPanel #textAlignSelect {
    display: none !important;
}

/* hide "Save Canvas / Load Canvas" duplicates — they live in Export menu */
.editor-shell #panel-label #mainPanel > button:nth-last-of-type(1),
.editor-shell #panel-label #mainPanel > button:nth-last-of-type(2) {
    display: none !important;
}

/* ----- Shape picker list (rail panel-shape) ----- */
.editor-shell .shape-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}
.editor-shell .shape-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.editor-shell .shape-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    padding: 4px 4px 2px;
}
.editor-shell .shape-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.editor-shell .avnac-panel-wrap .shape-row {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-2);
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 400;
    font-family: inherit;
    text-align: left;
    width: 100%;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.editor-shell .avnac-panel-wrap .shape-row:hover {
    background: var(--accent-soft);
    color: var(--ink);
    border-color: var(--line);
}
.editor-shell .shape-row-icon {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--surface-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
}
.editor-shell .shape-row-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0;
    stroke-linejoin: round;
}
.editor-shell .shape-row.shape-row-stroke .shape-row-icon svg {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}
.editor-shell .shape-row-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----- Template picker list (rail panel-templates) ----- */
.editor-shell .template-categories {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
}
.editor-shell .template-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.editor-shell .template-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    padding: 4px 4px 2px;
}
.editor-shell .template-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.editor-shell .avnac-panel-wrap .template-row {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-2);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: inherit;
    text-align: left;
    width: 100%;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.editor-shell .avnac-panel-wrap .template-row:hover {
    background: var(--accent-soft);
    color: var(--ink);
    border-color: var(--line);
}
.editor-shell .template-row-thumb {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--surface-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
}
.editor-shell .template-row-thumb svg {
    display: block;
}
.editor-shell .template-row-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.editor-shell .template-row-name {
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-shell .template-row-meta {
    font-size: 11px;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----- History buttons (undo / redo) ----- */
.editor-shell .history-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 4px;
}
.editor-shell .history-group .header-icon-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.editor-shell .history-group .header-icon-btn svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ----- Color picker trigger + swatch (top toolbar) ----- */
.editor-shell .color-trigger {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 3px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, border-color 0.12s;
    flex: 0 0 auto;
    font-family: inherit;
}
.editor-shell .color-trigger:hover {
    background: var(--accent-soft);
}
.editor-shell .color-trigger[aria-expanded="true"] {
    background: var(--accent-soft);
    border-color: var(--line);
}
.editor-shell .color-trigger-glyph {
    --swatch-color: #0f0f12;
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    box-sizing: border-box;
    position: relative;
}
.editor-shell .color-trigger-glyph.color-trigger-glyph-fill,
.editor-shell .color-trigger-glyph.color-trigger-glyph-bg {
    background: var(--swatch-color);
    border: 1px solid rgba(15, 15, 18, 0.18);
}
.editor-shell .color-trigger-glyph.color-trigger-glyph-stroke {
    background: var(--surface);
    border: 3px solid var(--swatch-color);
}
.editor-shell .color-trigger-glyph.is-none {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    overflow: hidden;
}
.editor-shell .color-trigger-glyph.is-none::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent calc(50% - 1px), #ef4444 calc(50% - 1px), #ef4444 calc(50% + 1px), transparent calc(50% + 1px));
    pointer-events: none;
}

/* ----- Color picker popover ----- */
.editor-shell .color-popover {
    position: fixed;
    z-index: 80;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 10px;
    width: 232px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}
.editor-shell .color-popover.hidden { display: none !important; }
.editor-shell .color-popover-none {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.editor-shell .color-popover-none:hover {
    background: var(--accent-soft);
    color: var(--ink);
    border-color: var(--line-strong);
}
.editor-shell .color-popover-none-mark {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
}
.editor-shell .color-popover-none-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent calc(50% - 1px), #ef4444 calc(50% - 1px), #ef4444 calc(50% + 1px), transparent calc(50% + 1px));
}
.editor-shell .color-popover-palette {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}
.editor-shell .color-swatch-btn {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 5px;
    border: 1px solid rgba(15, 15, 18, 0.12);
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s ease, box-shadow 0.12s;
}
.editor-shell .color-swatch-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 2px rgba(15, 15, 18, 0.08);
}
.editor-shell .color-popover-custom {
    display: flex;
    align-items: center;
    gap: 6px;
}
.editor-shell .color-popover-native-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--ink-2);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.editor-shell .color-popover-native-wrap:hover {
    background: var(--accent-soft);
    border-color: var(--line-strong);
    color: var(--ink);
}
.editor-shell .color-popover-native-wrap input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}
.editor-shell .color-popover-native-icon svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}
.editor-shell .color-popover-hex {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 12.5px;
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    outline: none;
    text-transform: lowercase;
    min-width: 0;
    box-sizing: border-box;
}
.editor-shell .color-popover-hex:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.06);
}
.editor-shell .color-popover-width {
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
    margin-top: 2px;
}
.editor-shell .color-popover-width-label {
    font-size: 11.5px;
    color: var(--ink-2);
    flex: 0 0 auto;
}
.editor-shell .color-popover-range {
    flex: 1 1 auto;
    min-width: 0;
    accent-color: var(--ink);
}
.editor-shell .color-popover-widthnum {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    padding: 4px 6px;
    width: 46px;
    font-size: 12px;
    color: var(--ink);
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    text-align: center;
}
.editor-shell .color-popover-widthnum::-webkit-inner-spin-button,
.editor-shell .color-popover-widthnum::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.editor-shell .color-popover-width-suffix {
    font-size: 11px;
    color: var(--ink-3);
}

/* Grid button sized to match the background color trigger glyph */
.editor-shell #labelGridBtn {
    width: 28px;
    height: 28px;
    padding: 3px;
}
.editor-shell #labelGridBtn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.6;
}

/* ----- Grid settings popover ----- */
.editor-shell .grid-popover {
    position: fixed;
    z-index: 80;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    width: 220px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
    font-size: 12.5px;
}
.editor-shell .grid-popover.hidden { display: none !important; }

/* ----- Variable chip menu (compact dropdown for panel input buttons) -----
   Selector is NOT scoped under .editor-shell because the menu is mounted
   at body level (outside the editor shell) so that position: fixed isn't
   trapped inside a nested stacking context. */
.variable-chip-menu {
    position: fixed;
    z-index: 90;
    background: #ffffff;
    border: 1px solid #e2e6ed;
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(15, 15, 18, 0.10), 0 1px 3px rgba(15, 15, 18, 0.05);
    padding: 6px;
    width: 220px;
    max-height: 240px;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2px;
    pointer-events: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.variable-chip-menu.hidden { display: none !important; }
.variable-chip-menu .vcm-chip {
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    color: #0f0f12;
    padding: 6px 10px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    margin: 0;
    box-shadow: none;
    transition: background 0.1s, color 0.1s;
}
.variable-chip-menu .vcm-chip:hover {
    background: #e8edf5;
}
.variable-chip-menu .vcm-empty {
    padding: 12px;
    font-size: 11.5px;
    color: #71717a;
    font-style: italic;
    line-height: 1.45;
    text-align: center;
}

/* ----- Variable picker popover ----- */
.editor-shell .variable-popover {
    position: fixed;
    z-index: 80;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0;
    width: 360px;
    max-height: min(80vh, 640px);
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    font-size: 12.5px;
}
.editor-shell .variable-popover.hidden { display: none !important; }
.editor-shell .variable-popover > .variable-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 6px;
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}
.editor-shell .variable-popover-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    line-height: 1.4;
}
.editor-shell .variable-popover-close:hover { background: var(--accent-soft); color: var(--ink); }
/* Body — scrollable content area below the sticky panel-style header. */
.editor-shell .variable-popover-body {
    overflow-y: auto;
    padding: 12px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
}
.editor-shell .variable-popover code {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11.5px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: var(--ink);
}
.editor-shell .variable-popover-divider {
    height: 1px;
    background: var(--line);
    margin: 4px 0;
}
.editor-shell .variable-popover .batch-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    margin: 0 0 8px;
}
.editor-shell .variable-popover .batch-tab {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--ink-3);
    padding: 6px 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}
.editor-shell .variable-popover .batch-tab:hover { color: var(--ink); }
.editor-shell .variable-popover .batch-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.editor-shell .variable-popover .batch-pane { margin-bottom: 8px; }
.editor-shell .variable-popover .batch-pane[hidden] { display: none !important; }
.editor-shell .variable-popover .batch-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    padding: 8px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    color: var(--ink);
    resize: vertical;
    min-height: 100px;
}
.editor-shell .variable-popover .batch-textarea:focus {
    outline: none;
    border-color: var(--ink-2);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}
.editor-shell .variable-popover .batch-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 12px;
    color: var(--ink);
    background: var(--surface);
}
.editor-shell .variable-popover .batch-input:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06); }
.editor-shell .variable-popover .batch-hint { color: var(--ink-3); font-size: 11px; line-height: 1.45; margin: 6px 0 0; }
.editor-shell .variable-popover .batch-hint strong { color: var(--ink); }
.editor-shell .variable-popover .batch-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--surface-2);
    cursor: pointer;
}
.editor-shell .variable-popover .batch-upload:hover { background: var(--accent-soft); }
.editor-shell .variable-popover .batch-upload-cta { font-size: 12px; font-weight: 500; color: var(--ink); }
.editor-shell .variable-popover .batch-upload-name { font-size: 11.5px; color: var(--ink-3); flex: 1; }
.editor-shell .variable-popover .print-modal-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    margin: 6px 0;
}
.editor-shell .variable-popover .print-modal-error[hidden] { display: none !important; }
.editor-shell .variable-popover .batch-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
}
.editor-shell .variable-popover .batch-progress[hidden] { display: none !important; }
.editor-shell .variable-popover .batch-progress-bar {
    flex: 1;
    height: 5px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.editor-shell .variable-popover .batch-progress-bar span {
    display: block;
    height: 100%;
    background: var(--ink);
    width: 0%;
    transition: width 0.18s;
}
.editor-shell .variable-popover .batch-progress-text { font-size: 11.5px; color: var(--ink-2); min-width: 50px; text-align: right; }
.editor-shell .variable-popover-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.editor-shell .variable-popover-secondary,
.editor-shell .variable-popover-primary {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
    box-shadow: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.editor-shell .variable-popover-secondary {
    background: var(--surface);
    color: var(--ink);
}
.editor-shell .variable-popover-secondary:hover { background: var(--accent-soft); }
.editor-shell .variable-popover-secondary.danger { color: #b91c1c; border-color: #fecaca; }
.editor-shell .variable-popover-secondary.danger:hover { background: #fef2f2; }
.editor-shell .variable-popover-primary {
    background: var(--ink);
    color: var(--surface);
    border-color: var(--ink);
    margin-left: auto;
    font-weight: 600;
}
.editor-shell .variable-popover-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.editor-shell .variable-popover-primary:disabled { background: var(--ink-3); border-color: var(--ink-3); cursor: not-allowed; }
.editor-shell .variable-popover .batch-status {
    font-size: 11.5px;
    color: var(--ink-3);
    line-height: 1.45;
    margin-top: 4px;
}
.editor-shell .variable-popover .batch-status[hidden] { display: none !important; }
.editor-shell .variable-popover .batch-status.is-ok { color: #047857; }
.editor-shell .variable-popover .batch-status.is-warn { color: #b45309; }
.editor-shell .variable-popover .batch-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}
.editor-shell .variable-popover .batch-status-row .batch-status { flex: 1 1 auto; margin: 0; }
.editor-shell .variable-popover .batch-clear-link {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    color: #b91c1c;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    margin: 0;
    flex: 0 0 auto;
}
.editor-shell .variable-popover .batch-clear-link:hover {
    background: #fef2f2;
}
.editor-shell .variable-popover .batch-clear-link[hidden] { display: none !important; }
.editor-shell .variable-popover-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.editor-shell .variable-popover-help {
    margin: 0;
    font-size: 11.5px;
    color: var(--ink-3);
    line-height: 1.45;
}
.editor-shell .variable-popover-help strong { color: var(--ink); }
.editor-shell .variable-popover-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.editor-shell .variable-popover-section-title {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
}
.editor-shell .variable-popover-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 100px;
    overflow-y: auto;
}
.editor-shell .variable-popover-list:empty::after {
    content: "No tokens in this label yet.";
    color: var(--ink-3);
    font-size: 11.5px;
    font-style: italic;
}
.editor-shell .variable-popover .vp-chip {
    -webkit-appearance: none;
    appearance: none;
    background: var(--accent-soft);
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    margin: 0;
    box-shadow: none;
    line-height: 1.4;
}
.editor-shell .variable-popover .vp-chip:hover {
    background: var(--ink);
    color: var(--surface);
    border-color: var(--ink);
}
/* ----- Printer settings popover ----- */
.editor-shell .printer-settings-popover {
    position: fixed;
    z-index: 80;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 14px 16px;
    width: 300px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
    font-size: 12.5px;
}
.editor-shell .printer-settings-popover.hidden { display: none !important; }
.editor-shell .printer-settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
}
.editor-shell .printer-settings-label {
    flex: 1 1 auto;
    color: var(--ink-2);
    font-size: 12px;
}
.editor-shell .printer-settings-status-row {
    align-items: flex-start;
}
.editor-shell .printer-settings-status {
    flex: 1 1 160px;
    font-size: 12px;
    color: var(--ink-3);
    text-align: right;
    max-width: none;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}
.editor-shell .printer-settings-status.is-ok { color: #047857; }
.editor-shell .printer-settings-status.is-warn { color: #b45309; }
.editor-shell .printer-settings-status.is-err { color: #b91c1c; }
.editor-shell .printer-settings-seg {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.editor-shell .printer-settings-seg .seg-btn {
    -webkit-appearance: none;
    appearance: none;
    background: var(--surface);
    border: 0;
    color: var(--ink-2);
    padding: 5px 10px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    border-right: 1px solid var(--line);
    transition: background 0.12s, color 0.12s;
}
.editor-shell .printer-settings-seg .seg-btn:last-child { border-right: 0; }
.editor-shell .printer-settings-seg .seg-btn:hover { background: var(--accent-soft); color: var(--ink); }
.editor-shell .printer-settings-seg .seg-btn.active {
    background: var(--ink);
    color: var(--surface);
}
.editor-shell .printer-settings-num {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 12px;
    color: var(--ink);
}
.editor-shell .printer-settings-suffix {
    font-size: 11.5px;
    color: var(--ink-3);
}
.editor-shell .printer-settings-numwrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.editor-shell .printer-settings-num.has-suffix {
    padding-right: 30px;
}
.editor-shell .printer-settings-inline-suffix {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 11.5px;
    color: var(--ink-3);
}
.editor-shell .printer-settings-actions {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: flex;
    gap: 8px;
}
.editor-shell .printer-settings-secondary {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    background: var(--accent-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    color: var(--ink);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}
.editor-shell .printer-settings-secondary:hover {
    background: var(--ink);
    color: var(--surface);
}
.editor-shell .grid-popover-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--ink-2);
    user-select: none;
}
.editor-shell .grid-popover-toggle:hover { color: var(--ink); }
.editor-shell .grid-popover-toggle input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    margin: 0;
    flex: 0 0 auto;
}
.editor-shell .grid-popover-toggle input[type="checkbox"]:checked {
    background: var(--ink);
    border-color: var(--ink);
}
.editor-shell .grid-popover-toggle input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.editor-shell .grid-popover-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}
.editor-shell .grid-popover-row.grid-popover-row-borderless {
    border-top: none;
    padding-top: 0;
}
.editor-shell .grid-popover-label {
    flex: 1 1 auto;
    color: var(--ink-2);
}
.editor-shell .grid-popover-value {
    flex: 0 0 84px;
    position: relative;
    display: inline-flex;
    align-items: center;
}
.editor-shell .grid-popover-value .grid-popover-suffix {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 11.5px;
    color: var(--ink-3);
}
.editor-shell .grid-popover-num {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    padding: 5px 22px 5px 8px;
    width: 100%;
    font-size: 12.5px;
    color: var(--ink);
    font-family: inherit;
    outline: none;
    text-align: right;
    box-sizing: border-box;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.editor-shell .grid-popover-num::-webkit-inner-spin-button,
.editor-shell .grid-popover-num::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.editor-shell .grid-popover-num:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.06);
}
.editor-shell .grid-popover-suffix {
    font-size: 11.5px;
    color: var(--ink-3);
}

/* ----- Rotation pill ----- */
.editor-shell .rotation-pill {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    position: relative;
}
.editor-shell .rotation-pill-trigger {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-2);
    border-radius: 8px;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 12.5px;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.editor-shell .rotation-pill-trigger:hover,
.editor-shell .rotation-pill-trigger[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--ink);
}
.editor-shell .rotation-pill.is-zero .rotation-pill-value,
.editor-shell .rotation-pill.is-zero .rotation-pill-suffix { display: none; }
.editor-shell .rotation-pill-icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}
.editor-shell .rotation-pill-value {
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.editor-shell .rotation-pill-suffix {
    font-size: 11px;
    color: var(--ink-3);
}
.editor-shell .rotation-pill-input {
    -webkit-appearance: none;
    appearance: none;
    -moz-appearance: textfield;
    display: none;
    border: 1px solid var(--ink);
    background: var(--surface);
    border-radius: 8px;
    padding: 0 10px;
    margin: 0;
    height: 32px;
    width: 64px;
    text-align: center;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--ink);
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.06);
    box-sizing: border-box;
}
.editor-shell .rotation-pill-input::-webkit-inner-spin-button,
.editor-shell .rotation-pill-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.editor-shell .rotation-pill.editing .rotation-pill-trigger { display: none; }
.editor-shell .rotation-pill.editing .rotation-pill-input { display: inline-flex; }

/* ----- Rotation scrubber popover ----- */
.editor-shell .rotation-scrubber {
    position: fixed;
    z-index: 80;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 12px 14px 8px;
    width: 260px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
}
.editor-shell .rotation-scrubber.hidden { display: none !important; }
.editor-shell .rotation-scrubber-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.editor-shell .rotation-scrubber-reset {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    flex: 0 0 auto;
}
.editor-shell .rotation-scrubber-reset:hover {
    background: var(--accent-soft);
    color: var(--ink);
    border-color: var(--line-strong);
}
.editor-shell .rotation-scrubber-range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    accent-color: var(--ink);
    margin: 0;
    cursor: pointer;
}
.editor-shell .rotation-scrubber-range::-webkit-slider-runnable-track {
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
}
.editor-shell .rotation-scrubber-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ink);
    border: 2px solid var(--surface);
    box-shadow: 0 1px 3px rgba(15, 15, 18, 0.18);
    margin-top: -5px;
    cursor: pointer;
}
.editor-shell .rotation-scrubber-range::-moz-range-track {
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    border: none;
}
.editor-shell .rotation-scrubber-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ink);
    border: 2px solid var(--surface);
    box-shadow: 0 1px 3px rgba(15, 15, 18, 0.18);
    cursor: pointer;
}
.editor-shell .rotation-scrubber-ticks {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    font-size: 10.5px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    /* Reset button width compensation so 0° sits under the slider midpoint */
    padding-right: 60px;
}
.editor-shell .rotation-scrubber-ticks span:nth-child(1) { text-align: left; }
.editor-shell .rotation-scrubber-ticks span:nth-child(2) { text-align: center; }
.editor-shell .rotation-scrubber-ticks span:nth-child(3) { text-align: center; }
.editor-shell .rotation-scrubber-ticks span:nth-child(4) { text-align: center; }
.editor-shell .rotation-scrubber-ticks span:nth-child(5) { text-align: right; }

/* ----- Inline element controls on the top toolbar ----- */
.editor-shell .top-toolbar.floating-pill {
    flex-wrap: wrap;
    height: auto;
    min-height: 44px;
    row-gap: 4px;
    padding-top: 5px;
    padding-bottom: 5px;
    max-width: calc(100vw - var(--rail-w) - 4 * var(--shell-pad));
}
.editor-shell.panel-open .top-toolbar.floating-pill,
.editor-shell.panel-active .top-toolbar.floating-pill {
    max-width: calc(100vw - var(--rail-w) - 320px - 4 * var(--shell-pad));
}

.editor-shell .top-toolbar .pill-color {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    width: 26px;
    height: 26px;
    padding: 0;
    cursor: pointer;
    flex: 0 0 26px;
    margin: 0 1px;
}
.editor-shell .top-toolbar .pill-color::-webkit-color-swatch-wrapper { padding: 2px; }
.editor-shell .top-toolbar .pill-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}
.editor-shell .top-toolbar .pill-color::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}
.editor-shell .top-toolbar .pill-color:hover { border-color: var(--line-strong); }
.editor-shell .top-toolbar .pill-color-stroke {
    background:
        linear-gradient(45deg, transparent 45%, var(--line) 45%, var(--line) 55%, transparent 55%);
}
.editor-shell .top-toolbar .inline-num-control {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 2px;
    flex: 0 0 auto;
}
.editor-shell .top-toolbar .inline-num-icon {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: var(--ink-3);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}
.editor-shell .top-toolbar .pill-num.pill-num-tight {
    width: 44px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 3px 4px;
    text-align: center;
}
.editor-shell .top-toolbar .pill-num.pill-num-tight:hover { border-color: var(--line); }
.editor-shell .top-toolbar .pill-num.pill-num-tight:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.06);
    outline: none;
}
.editor-shell .top-toolbar.hide-text-rows .props-text-only-inline { display: none !important; }

/* ----- Props popover (artboard label-options only) ----- */
.editor-shell .props-popover {
    position: fixed;
    z-index: 80;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 6px 12px 10px;
    width: 280px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    font-size: 12.5px;
    pointer-events: auto;
}
.editor-shell .props-popover.hidden {
    display: none !important;
}
.editor-shell .props-popover-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}
.editor-shell .props-popover-section:last-child { border-bottom: none; }
.editor-shell .props-popover-section-title {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    margin-bottom: 2px;
}
.editor-shell .props-popover-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
}
.editor-shell .props-popover-label {
    flex: 0 0 88px;
    font-size: 12px;
    color: var(--ink-2);
    letter-spacing: 0.01em;
}
.editor-shell .props-popover-num {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 12.5px;
    color: var(--ink);
    width: 64px;
    box-sizing: border-box;
    font-family: inherit;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.editor-shell .props-popover-num.props-popover-num-tight { width: 56px; }
.editor-shell .props-popover-num.props-popover-num-wide { width: 76px; }
.editor-shell .props-popover-num:focus {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}
.editor-shell .props-popover-num::-webkit-inner-spin-button,
.editor-shell .props-popover-num::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.editor-shell .props-popover-color {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 7px;
    width: 32px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    flex: 0 0 32px;
}
.editor-shell .props-popover-color::-webkit-color-swatch-wrapper { padding: 2px; }
.editor-shell .props-popover-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}
.editor-shell .props-popover-suffix {
    font-size: 11.5px;
    color: var(--ink-3);
    flex: 0 0 auto;
}
.editor-shell .props-popover-input-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}
.editor-shell .props-popover-range {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    accent-color: var(--ink);
    margin: 0;
}
.editor-shell .props-popover-row-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}
.editor-shell .props-popover-row-stack-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.editor-shell .props-popover-row-stack-head .props-popover-label {
    flex: 1 1 auto;
}
.editor-shell .props-popover-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--ink-2);
    user-select: none;
}
.editor-shell .props-popover-toggle input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    margin: 0;
    flex: 0 0 auto;
}
.editor-shell .props-popover-toggle input[type="checkbox"]:checked {
    background: var(--ink);
    border-color: var(--ink);
}
.editor-shell .props-popover-toggle input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.editor-shell .props-popover-mini {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 11.5px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    flex: 0 0 auto;
}
.editor-shell .props-popover-mini:hover {
    background: var(--accent-soft);
    border-color: var(--line-strong);
}
.editor-shell .props-popover-tbtn {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 7px;
    width: 30px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.editor-shell .props-popover-tbtn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.editor-shell .props-popover-tbtn:hover {
    background: var(--accent-soft);
    color: var(--ink);
    border-color: var(--line-strong);
}
.editor-shell .props-popover-tbtn.active {
    background: var(--ink);
    color: #fafafa;
    border-color: var(--ink);
}
.editor-shell .props-popover.hide-text-rows .props-text-only { display: none !important; }

/* Make the More-options pill compact in the top toolbar */
.editor-shell .props-trigger { max-width: 110px; }
.editor-shell .props-trigger .pill-trigger-icon {
    stroke: var(--ink-2);
    fill: var(--ink-2);
}