﻿/* ============================================================
   PART-PAINT MODE
   ============================================================ */

/* When part-paint mode is active: dim sidebars, disable pointer events on all UI except canvas and pp elements */
body.part-paint-active #sidebar,
body.part-paint-active #left-sidebar,
body.part-paint-active #bottom-floating-toolbar,
body.part-paint-active #mobile-bottom-nav,
body.part-paint-active #mobile-top-bar,
body.part-paint-active #top-bar {
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.25s;
}

body.part-paint-active #canvas-container {
    cursor: crosshair;
}

/* Mode banner */
.pp-mode-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.93);
    color: #e2e8f0;
    border-radius: 14px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.pp-mode-banner i {
    color: #60a5fa;
    font-size: 1rem;
}

.pp-exit-btn {
    background: rgba(239,68,68,0.18);
    border: 1.5px solid rgba(239,68,68,0.5);
    color: #fca5a5;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    margin-right: 4px;
}
.pp-exit-btn:hover {
    background: rgba(239,68,68,0.35);
    color: #fff;
}

/* Floating color panel */
.pp-color-panel {
    position: fixed;
    z-index: 9100;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.12);
    padding: 0;
    min-width: 250px;
    max-width: 270px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: pp-panel-in 0.15s ease;
}

@keyframes pp-panel-in {
    from { opacity: 0; transform: scale(0.92) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.pp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.pp-panel-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
}

.pp-panel-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
}
.pp-panel-close:hover { color: #ef4444; }

.pp-panel-reset-row {
    padding: 6px 10px 4px;
    border-bottom: 1px solid #f1f5f9;
}

.pp-reset-btn {
    width: 100%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    transition: background 0.15s;
}
.pp-reset-btn:hover { background: #e2e8f0; }

.pp-swatches {
    padding: 8px 10px 12px;
    max-height: 340px;
    overflow-y: auto;
}

.pp-swatch-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.pp-swatches-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 4px;
}

.pp-swatch {
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    outline: none;
    position: relative;
}

/* Round solid-color swatches */
.pp-swatch.pp-swatch-round {
    border-radius: 50%;
}

/* Square texture swatches */
.pp-swatch.pp-swatch-tex {
    border-radius: 5px;
}

.pp-swatch:hover {
    transform: scale(1.18);
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
    z-index: 1;
}
.pp-swatch.pp-swatch-active {
    box-shadow: 0 0 0 3px var(--secondary), 0 2px 8px rgba(0,0,0,0.18);
    transform: scale(1.12);
}

/* ============================================================
   VIEWER MODE ג€” read-only live-share styles
   Applied when <body class="viewer-mode"> (viewer.html)
   ============================================================ */

/* ============================================================
   PRESENTATION MODE ג€” ׳×׳¦׳•׳’׳” ׳—׳•׳₪׳©׳™׳× ׳׳׳ ׳׳׳©׳§ ׳¢׳¨׳™׳›׳”
   Applied when <body class="presentation-mode">
   ============================================================ */

body.presentation-mode #sidebar,
body.presentation-mode #left-sidebar,
body.presentation-mode #top-bar,
body.presentation-mode #left-sidebar-toolbar,
body.presentation-mode #bottom-floating-toolbar,
body.presentation-mode #column-quick-edit,
body.presentation-mode #full-corner-quick-edit,
body.presentation-mode #wing-edit-banner,
body.presentation-mode #upper-unit-edit-banner,
body.presentation-mode #mobile-bottom-nav,
body.presentation-mode #mobile-top-bar,
body.presentation-mode .mobile-panel,
body.presentation-mode #mobile-col-bar,
body.presentation-mode #mobile-cell-right-panel,
body.presentation-mode #mobile-cell-left-panel,
body.presentation-mode #mobile-col-sheet {
    display: none !important;
}

body.presentation-mode #canvas-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
    cursor: grab;
}

body.presentation-mode #canvas-container:active {
    cursor: grabbing;
}

body.presentation-mode #canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

#presentation-exit-btn {
    display: none;
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99990;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 30px;
    padding: 8px 20px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    transition: background 0.2s;
    white-space: nowrap;
}
#presentation-exit-btn:hover {
    background: rgba(30, 58, 95, 0.9);
}


/* Hide all editor chrome in viewer mode */
body.viewer-mode #sidebar,
body.viewer-mode #left-sidebar,
body.viewer-mode #top-bar,
body.viewer-mode #mobile-bottom-nav,
body.viewer-mode #mobile-top-bar,
body.viewer-mode #bottom-floating-toolbar,
body.viewer-mode #column-quick-edit,
body.viewer-mode #full-corner-quick-edit,
body.viewer-mode #mobile-col-bar,
body.viewer-mode #mobile-cell-right-panel,
body.viewer-mode #mobile-cell-left-panel,
body.viewer-mode #mobile-col-sheet,
body.viewer-mode #wing-edit-banner,
body.viewer-mode .mobile-panel {
    display: none !important;
}

/* Canvas fills the space between viewer top-bar and info-bar */
body.viewer-mode #canvas-container {
    position: fixed;
    top: 88px;
    bottom: 44px;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
}

body.viewer-mode #canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Viewer top bar */
#viewer-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 88px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

#viewer-top-bar .vtb-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 4px;
    flex: 1;
}

#viewer-top-bar .vtb-row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 8px;
}

/* LIVE badge */
.viewer-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16,185,129,0.18);
    border: 1px solid rgba(16,185,129,0.5);
    color: #34d399;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.viewer-live-badge .live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

/* Flash animation when a live update arrives */
@keyframes live-flash {
    0%   { background: rgba(16,185,129,0.35); }
    100% { background: rgba(16,185,129,0.18); }
}

.viewer-live-badge.flash {
    animation: live-flash 0.6s ease-out;
}

/* View-mode tabs in viewer top bar */
.viewer-tab-btn {
    flex: 1;
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.65);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
    white-space: nowrap;
}

.viewer-tab-btn.active,
.viewer-tab-btn:hover {
    background: rgba(255,255,255,0.18);
    color: white;
    border-color: rgba(255,255,255,0.35);
}

/* Viewer bottom info bar ג€” legacy rules removed; all styles now in viewer.html <style> block */
/* #viewer-info-bar styles are defined inline in viewer.html to avoid conflicts */

/* Viewer chat panel ג€” bottom sheet on mobile, side panel on desktop */
#viewer-chat-panel {
    position: fixed;
    bottom: 44px; /* above info bar */
    left: 0;
    right: 0;
    height: 55vh;
    max-height: 420px;
    background: white;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.2);
    z-index: 1100;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: inherit;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

#viewer-chat-panel.open {
    display: flex;
}

@media (min-width: 600px) {
    #viewer-chat-panel {
        left: auto;
        right: 16px;
        bottom: 60px;
        width: 320px;
        height: 420px;
        max-height: 420px;
        border-radius: 16px;
        box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    }
}

.viewer-chat-header {
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.viewer-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
}

.viewer-chat-messages::-webkit-scrollbar { width: 4px; }
.viewer-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.viewer-chat-input-row {
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: white;
}

/* Chat message bubbles */
.chat-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-bubble.designer {
    align-self: flex-start;
    background: #e0f2fe;
    color: #0c4a6e;
    border-bottom-left-radius: 4px;
}

.chat-bubble.client {
    align-self: flex-end;
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble .bubble-meta {
    font-size: 0.68rem;
    opacity: 0.65;
    margin-top: 3px;
    text-align: right;
}

/* Floating chat button in viewer */
#viewer-chat-float-btn {
    position: fixed;
    bottom: 56px; /* above info bar */
    right: 16px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37,99,235,0.45);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: transform 0.18s, box-shadow 0.18s;
}

#viewer-chat-float-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(37,99,235,0.55);
}

#viewer-chat-float-btn .vchat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Client name prompt overlay */
#viewer-name-prompt {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#viewer-name-prompt .vnp-card {
    background: white;
    border-radius: 18px;
    padding: 28px 24px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    text-align: center;
}

#viewer-name-prompt .vnp-card h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: #0f172a;
}

#viewer-name-prompt .vnp-card p {
    margin: 0 0 18px;
    font-size: 0.88rem;
    color: #64748b;
}

#viewer-name-prompt input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 14px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.18s;
}

#viewer-name-prompt input:focus {
    border-color: #2563eb;
}

#viewer-name-prompt button {
    width: 100%;
    padding: 11px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s;
}

#viewer-name-prompt button:hover {
    background: #1d4ed8;
}

/* Loading screen for viewer */
#viewer-loading {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 18px;
    font-family: inherit;
}

#viewer-loading .vl-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: vl-spin 0.9s linear infinite;
}

@keyframes vl-spin {
    to { transform: rotate(360deg); }
}

#viewer-loading .vl-text {
    font-size: 1rem;
    opacity: 0.8;
    letter-spacing: 0.02em;
}

/* Share button pulse animation (used in index.html) */
@keyframes share-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

#btn-share-live {
    animation: share-pulse 2.5s ease-in-out infinite;
}

/* Designer chat panel (in index.html) */
#designer-chat-panel {
    transition: opacity 0.2s, transform 0.2s;
}

/* Unread badge pulse */
@keyframes badge-pop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.25); }
    100% { transform: scale(1); opacity: 1; }
}

#chat-unread-badge,
#mobile-chat-unread-badge {
    animation: badge-pop 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* Responsive: on very small screens, viewer tabs wrap */
@media (max-width: 360px) {
    .viewer-tab-btn {
        font-size: 0.7rem;
        padding: 4px 5px;
    }
    #viewer-top-bar .vtb-row1 {
        padding: 8px 10px 2px;
    }
}

/* ==========================================
   ׳׳“׳¨׳™׳ ׳׳™׳ ׳˜׳¨׳׳§׳˜׳™׳‘׳™ ג€” Product Tour
   ========================================== */

#tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    pointer-events: auto;
    display: none;
}

#tour-overlay svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#tour-tooltip {
    position: fixed;
    z-index: 100002;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.12);
    padding: 0;
    font-family: inherit;
    direction: rtl;
    display: none;
    overflow: hidden;
    animation: tourFadeIn 0.22s ease;
}

@keyframes tourFadeIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)  scale(1); }
}

.tour-tt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: white;
    padding: 13px 16px 11px;
    font-size: 0.95rem;
    font-weight: 700;
    gap: 8px;
}

.tour-close-btn {
    background: rgba(255,255,255,0.18);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.tour-close-btn:hover { background: rgba(255,255,255,0.32); }

#tour-tt-text {
    padding: 14px 16px 10px;
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.6;
}

.tour-tt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 12px;
    gap: 8px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.tour-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    border: none;
    padding: 0;
    display: inline-block;
}
.tour-dot.active {
    background: #2563eb;
    transform: scale(1.3);
}
.tour-dot:hover { background: #94a3b8; }

.tour-nav-btns {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.tour-nav-btns button {
    padding: 6px 13px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.tour-nav-btns button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

#tour-btn-next {
    background: #2563eb !important;
    color: white !important;
    border-color: #2563eb !important;
}
#tour-btn-next:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
}

#tour-btn-skip {
    color: #94a3b8 !important;
    border-color: transparent !important;
    background: transparent !important;
    padding: 6px 6px !important;
}
#tour-btn-skip:hover {
    color: #64748b !important;
    background: #f1f5f9 !important;
}

/* ׳›׳₪׳×׳•׳¨ ׳”׳“׳¨׳›׳” ׳‘-top-bar */
#btn-start-tour {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    font-weight: 700;
    gap: 5px;
}
#btn-start-tour:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

@media (max-width: 768px) {
    #tour-tooltip {
        width: calc(100vw - 24px);
        max-width: 360px;
    }
    .tour-tt-header { font-size: 0.88rem; padding: 11px 13px 9px; }
    #tour-tt-text   { font-size: 0.83rem; padding: 11px 13px 8px; }
}

/* ג”€ג”€ Tour Selection Bottom Sheet ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ */
#tour-sheet {
    animation: tourSheetIn 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes tourSheetIn {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}

.tour-sheet-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    direction: rtl;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.tour-sheet-card:hover,
.tour-sheet-card:active {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: scale(0.985);
}

.tour-sheet-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    line-height: 1;
}

.tour-sheet-info {
    flex: 1;
    min-width: 0;
}

.tour-sheet-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.tour-sheet-desc {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}

.tour-sheet-arrow {
    color: #94a3b8;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ============================================================
   MOBILE CRITICAL OVERRIDES (extracted from index.html)
   ============================================================ */
@media (max-width: 768px) {
    /* Column quick-edit: allowed on mobile ג€” floats below zokel via updateOverlaysPosition */
    /* (no hide rule here ג€” it's controlled by .visible class in updateQuickEditPanelUI) */
    /* Hide old bottom sheet cell editor ג€” replaced by side panels */
    #mobile-cell-sheet { display: none !important; }
    /* Nav button colors */
    .mobile-nav-btn {
        color: #64748b !important;
        background: transparent !important;
        border: none !important;
    }
    .mobile-nav-btn span { color: #64748b !important; }
    .mobile-nav-btn i { color: #64748b !important; }
    .mobile-nav-btn.active { color: #3b82f6 !important; }
    .mobile-nav-btn.active span { color: #3b82f6 !important; }
    .mobile-nav-btn.active i { color: #3b82f6 !important; }
    /* Col sheet: anchor to bottom:0, clear nav bar via inner scroll padding */
    #mobile-col-sheet {
        bottom: 0 !important;
        z-index: 490 !important;
    }
    /* Cell side panels: always rendered (hidden via transform, not display:none) */
    #mobile-cell-right-panel,
    #mobile-cell-left-panel {
        display: flex !important;
        z-index: 490 !important;
    }
    /* Nav bar must be above sheets */
    #mobile-bottom-nav {
        z-index: 500 !important;
    }
    /* Drag handles: smaller on mobile */
    .drag-handle {
        width: 22px !important;
        height: 22px !important;
        border-width: 1.5px !important;
        font-size: 9px !important;
    }
    .drag-handle::before, .drag-handle::after { font-size: 9px !important; }
    .drag-tooltip { display: none !important; }
    /* Plus buttons: hidden on mobile ג€” dim-container is the tap target */
    .plus-btn { display: none !important; }
    /* Prevent black flash on touch */
    #canvas-container, #canvas-container canvas {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
    }
    /* Mobile top bar ג€” 2 rows */
    #mobile-top-bar {
        position: fixed !important;
        top: 0 !important; left: 0 !important; right: 0 !important;
        height: 88px !important;
        background: rgba(255,255,255,0.97) !important;
        border-bottom: 1px solid #e2e8f0 !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 500 !important;
    }
    #mobile-top-row1 {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 5px 10px 4px !important;
        height: 44px !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
    #mobile-top-row2 {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 0 8px !important;
        height: 44px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .mobile-view-tab {
        flex: 1 !important;
        height: 32px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        background: #f8fafc !important;
        color: #64748b !important;
        font-size: 0.72rem !important;
        font-weight: 600 !important;
        font-family: inherit !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
    }
    .mobile-view-tab.active {
        background: #1e3a5f !important;
        color: white !important;
        border-color: #1e3a5f !important;
    }
    /* Row 2 action buttons */
    .mobile-topbar-btn {
        min-width: 34px !important;
        height: 32px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        background: #f8fafc !important;
        color: #64748b !important;
        font-size: 0.85rem !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        padding: 0 8px !important;
        font-family: inherit !important;
    }
    .mobile-topbar-btn:disabled { opacity: 0.35 !important; }
    .mobile-topbar-btn.danger { color: #ef4444 !important; border-color: #fecaca !important; }
    .mobile-topbar-btn.active { background: #1e3a5f !important; color: white !important; border-color: #1e3a5f !important; }
    .mobile-topbar-sep {
        width: 1px !important; height: 22px !important;
        background: #e2e8f0 !important; flex-shrink: 0 !important; margin: 0 2px !important;
    }
    /* Row 2 dimension buttons (tap to open modal) */
    .mobile-topbar-dims {
        display: flex !important;
        align-items: center !important;
        gap: 3px !important;
        flex-shrink: 0 !important;
    }
    .mobile-topbar-dim-group {
        display: flex !important;
        align-items: center !important;
        gap: 2px !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 7px !important;
        padding: 0 5px !important;
        height: 32px !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    .mobile-topbar-dim-group:active { background: #e2e8f0 !important; }
    .mobile-topbar-dim-label {
        font-size: 0.65rem !important;
        font-weight: 700 !important;
        color: #94a3b8 !important;
        line-height: 1 !important;
        pointer-events: none !important;
    }
    .mobile-topbar-dim-val {
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        color: #1e3a5f !important;
        min-width: 28px !important;
        text-align: center !important;
        pointer-events: none !important;
    }
    .mobile-topbar-dim-x {
        font-size: 0.7rem !important;
        color: #94a3b8 !important;
        flex-shrink: 0 !important;
    }
    /* Dims bottom sheet */
    #dims-float-modal {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: translateY(calc(100% + 30px)) !important;
        transition: transform 0.28s cubic-bezier(0.32,0.72,0,1) !important;
        z-index: 1201 !important;
        background: rgba(255,255,255,0.97) !important;
        border-top: 1px solid var(--border) !important;
        border-left: none !important; border-right: none !important; border-bottom: none !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 10px 20px 14px !important;
        padding-bottom: calc(env(safe-area-inset-bottom) + 14px) !important;
        box-shadow: 0 -6px 30px rgba(0,0,0,0.12) !important;
        font-family: inherit !important;
    }
    /* Drag pill */
    #dims-float-modal::before {
        content: '' !important;
        display: block !important;
        width: 36px !important; height: 4px !important;
        background: var(--border) !important;
        border-radius: 99px !important;
        margin: 0 auto 12px !important;
    }
    #dims-float-modal.open {
        transform: translateY(0) !important;
    }
    .dfm-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 14px !important;
    }
    .dfm-title {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        color: var(--text-dark) !important;
        letter-spacing: 0.01em !important;
    }
    .dfm-close {
        width: 28px !important; height: 28px !important;
        border-radius: 50% !important;
        border: 1px solid var(--border) !important;
        background: var(--bg-light) !important;
        color: var(--text-light) !important;
        font-size: 0.85rem !important;
        cursor: pointer !important;
        display: flex !important; align-items: center !important; justify-content: center !important;
    }
    .dfm-close:active { background: var(--border) !important; }
    /* Each dim row: [lbl] [גˆ’] [slider+bubble] [+] */
    .dfm-row {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        margin-bottom: 12px !important;
    }
    .dfm-row:last-child { margin-bottom: 0 !important; }
    .dfm-lbl {
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        color: var(--text-light) !important;
        width: 36px !important;
        flex-shrink: 0 !important;
        text-align: center !important;
        letter-spacing: 0 !important;
    }
    .dfm-btn {
        width: 34px !important; height: 34px !important;
        border-radius: 10px !important;
        border: 1px solid var(--border) !important;
        background: var(--bg-light) !important;
        color: var(--text-dark) !important;
        font-size: 0.9rem !important;
        cursor: pointer !important;
        display: flex !important; align-items: center !important; justify-content: center !important;
        flex-shrink: 0 !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
    }
    .dfm-btn:active { background: var(--border) !important; }
    /* Slider wrapper ג€” column layout: bubble row on top, slider row below */
    .dfm-slider-wrap {
        flex: 1 !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
    }
    /* Bubble row ג€” fixed height, holds the floating bubble */
    .dfm-bubble-row {
        position: relative !important;
        height: 24px !important;
        width: 100% !important;
    }
    /* Slider row ג€” holds the native range + thumb label overlay */
    .dfm-slider-row {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        height: 36px !important; /* matches thumb height */
    }
    .dfm-slider {
        width: 100% !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        height: 5px !important;
        border-radius: 99px !important;
        background: var(--border) !important;
        outline: none !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 1 !important;
    }
    /* Thumb: large enough to show number inside */
    .dfm-slider::-webkit-slider-thumb {
        -webkit-appearance: none !important;
        width: 36px !important; height: 36px !important;
        border-radius: 50% !important;
        background: var(--secondary) !important;
        cursor: pointer !important;
        box-shadow: 0 2px 10px rgba(59,130,246,0.35) !important;
        border: 2px solid white !important;
    }
    .dfm-slider::-moz-range-thumb {
        width: 36px !important; height: 36px !important;
        border-radius: 50% !important;
        background: var(--secondary) !important;
        cursor: pointer !important;
        border: 2px solid white !important;
        box-shadow: 0 2px 10px rgba(59,130,246,0.35) !important;
    }
    /* Number label overlaid on the thumb ג€” centered in the 36px slider-row */
    .dfm-thumb-label {
        position: absolute !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        font-size: 0.65rem !important;
        font-weight: 700 !important;
        color: white !important;
        pointer-events: none !important;
        white-space: nowrap !important;
        z-index: 2 !important;
        line-height: 1 !important;
        transition: opacity 0.15s !important;
        text-align: center !important;
    }
    /* During drag: hide thumb label, show bubble above */
    .dfm-slider-wrap.dragging .dfm-thumb-label {
        opacity: 0 !important;
    }
    /* Value bubble ג€” sits in .dfm-bubble-row, hidden at rest */
    .dfm-val {
        position: absolute !important;
        bottom: 0 !important;
        transform: translateX(-50%) !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        color: var(--secondary) !important;
        background: var(--highlight) !important;
        border: 1px solid rgba(59,130,246,0.30) !important;
        border-radius: 8px !important;
        padding: 2px 7px !important;
        white-space: nowrap !important;
        pointer-events: none !important;
        line-height: 1.6 !important;
        opacity: 0 !important;
        transition: opacity 0.15s !important;
        box-shadow: 0 2px 8px rgba(59,130,246,0.15) !important;
    }
    /* Show bubble during drag */
    .dfm-slider-wrap.dragging .dfm-val {
        opacity: 1 !important;
    }
    /* Canvas: push down by 2-row top bar height */
    #canvas-container {
        top: 88px !important;
        height: calc(100dvh - 88px - 60px) !important;
    }
}
@media (min-width: 769px) {
    #mobile-top-bar { display: none !important; }
    #mobile-cell-right-panel,
    #mobile-cell-left-panel { display: none !important; }
    #dims-float-modal { display: none !important; }
}
/* === PRINT: hide ALL mobile UI ג€” overrides the !important rules above === */
@media print {
    #mobile-top-bar,
    #mobile-top-row1,
    #mobile-top-row2,
    #mobile-bottom-nav,
    #mobile-overlay,
    .mobile-panel,
    #mobile-cell-sheet,
    #mobile-cell-right-panel,
    #mobile-cell-left-panel,
    #mobile-col-sheet,
    #bottom-floating-toolbar,
    #column-quick-edit,
    #blueprint-layer { display: none !important; }
    /* Show the order modal content for printing */
    #order-modal { display: block !important; position: static !important; background: white !important; }
}
