:root {
    --header-h: 85px;
    --sidebar-w: 400px;
    --mobile-action-h: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --accent-color: #008ccf;
    --bg-light-blue: #ebf1f7;
    --border-color: #d1d1d1;
    --main-footer-h: 96px;
    --footer-h: 96px;
    --footer-peek-h: 320px;
    --font-main: 'Figtree', Arial, sans-serif;
    --cursor-lumines-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 32 32'%3E%3Cpath d='M6 3 L6 25 L12.2 18.7 L16.2 28 L19.2 26.7 L15.2 17.5 L24 17.5 Z' fill='%23008ccf'/%3E%3C/svg%3E") 4 2;
}

/* --- LAYOUT --- */
body {
    margin: 0;
    display: grid;
    grid-template-rows: var(--header-h) minmax(0, 1fr) 0;
    height: 100vh;
    font-family: var(--font-main);
    overflow: hidden;
    cursor: var(--cursor-lumines-arrow), auto;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button,
[role="button"],
[onclick],
label,
select,
input[type="button"],
input[type="submit"],
input[type="color"],
input[type="checkbox"],
input[type="radio"],
input[type="range"],
.canvas-tool-btn,
.canvas-tool-drawer-trigger {
    cursor: var(--cursor-lumines-arrow), auto !important;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0, 140, 207, 0.16), rgba(0, 140, 207, 0.16));
    accent-color: var(--accent-color);
    outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #d7e4ee 0%, #d7e4ee 100%);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 140, 207, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"]::-moz-range-track {
    height: 6px;
    border: none;
    border-radius: 999px;
    background: #d7e4ee;
}

input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: #7ec8e8;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 140, 207, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:active::-webkit-slider-thumb,
input[type="range"]:focus-visible::-webkit-slider-thumb {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(0, 140, 207, 0.36);
}

input[type="range"]:hover::-moz-range-thumb,
input[type="range"]:active::-moz-range-thumb,
input[type="range"]:focus-visible::-moz-range-thumb {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(0, 140, 207, 0.36);
}

input[type="range"]:focus-visible {
    outline: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(0, 140, 207, 0.16), 0 3px 10px rgba(0, 140, 207, 0.36);
}

input[type="range"]:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 4px rgba(0, 140, 207, 0.16), 0 3px 10px rgba(0, 140, 207, 0.36);
}

#content-wrapper {
    display: flex;
    flex-direction: row;
    height: 100%;
    overflow: hidden;
    position: relative;
    grid-row: 2;
}

.mobile-drawer-scrim,
.mobile-action-bar,
.mobile-more-menu {
    display: none;
}

/* --- HEADER --- */
.header {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 3px 6px rgba(0,0,0,.15);
    position: relative;
    z-index: 3000;
    grid-row: 1;
}

.header-left, .header-right { display: flex; align-items: center; gap: 20px; }
.header-center { display: flex; flex-direction: column; align-items: center; }
.header-action-cluster { display: flex; align-items: center; gap: 10px; }
.history-controls { display: flex; align-items: center; gap: 6px; }
.profile-finish-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.profile-finish-control select {
    height: 34px;
    max-width: 132px;
    border: 1px solid #d3dae3;
    border-radius: 999px;
    background: #fff;
    color: #233140;
    font-size: 12px;
    font-weight: 700;
    padding: 0 28px 0 12px;
    outline: none;
}
.profile-finish-control select:hover,
.profile-finish-control select:focus {
    border-color: #008ccf;
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.08);
}
.profile-finish-control input[type="color"] {
    width: 34px;
    height: 34px;
    padding: 2px;
    border: 2px solid #d3dae3;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
.profile-custom-ral-input {
    width: 82px;
    height: 34px;
    box-sizing: border-box;
    border: 1px solid #d3dae3;
    border-radius: 999px;
    background: #fff;
    color: #233140;
    font-size: 12px;
    font-weight: 800;
    padding: 0 12px;
    text-transform: uppercase;
    outline: none;
    line-height: 34px;
    text-align: center;
}
.profile-custom-ral-input:hover,
.profile-custom-ral-input:focus {
    border-color: #008ccf;
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.08);
}
.profile-ral-palette-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    min-width: 118px;
    border: 1px solid #d3dae3;
    border-radius: 999px;
    background: #fff;
    color: #008ccf;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    padding: 0 12px;
    line-height: 1;
}
.profile-ral-palette-btn::before {
    content: "";
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.18);
    background: var(--ral-preview, #ffffff);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32);
}
.profile-ral-palette-btn:hover,
.profile-ral-palette-btn:focus {
    border-color: #008ccf;
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.08);
}

.mobile-profile-finish-panel {
    display: none;
}

.mobile-profile-finish-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    align-items: center;
}

.mobile-profile-finish-select {
    min-width: 0;
    height: 36px;
    border: 1px solid #d3dae3;
    border-radius: 10px;
    background: #fff;
    color: #233140;
    font-size: 12px;
    font-weight: 800;
    padding: 0 28px 0 10px;
}

.mobile-profile-custom-ral-input {
    width: 64px;
    height: 36px;
    border-radius: 10px;
}

.mobile-profile-ral-palette-btn {
    min-width: 0;
    width: 42px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    font-size: 0;
}
.ral-palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px;
}
.ral-palette-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 2px 10px;
    min-height: 62px;
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    background: #fff;
    color: #233140;
    text-align: left;
    padding: 10px;
    cursor: pointer;
}
.ral-palette-card:hover,
.ral-palette-card.selected {
    border-color: #008ccf;
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.08);
}
.ral-palette-swatch {
    grid-row: 1 / span 2;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.16);
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.ral-palette-card strong {
    font-size: 12px;
    font-weight: 900;
}
.ral-palette-card small {
    color: #64748b;
    font-size: 10px;
    line-height: 1.2;
}
.project-name-header-input {
    width: 190px;
    height: 34px;
    box-sizing: border-box;
    border: 1px solid #d3dae3;
    border-radius: 999px;
    background: #ffffff;
    color: #233140;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 0 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.project-name-header-input::placeholder {
    color: #8a99a8;
    font-weight: 500;
}
.project-name-header-input:hover,
.project-name-header-input:focus {
    border-color: #008ccf;
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.08);
}
.project-name-header-input:disabled {
    background: #f4f7fa;
    color: #607080;
    cursor: not-allowed;
}
.project-lock-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 4px 0 8px;
    border: 1px solid #d3dae3;
    border-radius: 999px;
    background: #ffffff;
    box-sizing: border-box;
}
.project-lock-status {
    min-width: 74px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
}
.project-lock-status.locked {
    color: #0f766e;
}
.project-lock-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border-radius: 6px;
    border: 2px dashed var(--border-color);
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
    gap: 6px;
}
.project-lock-toggle-btn:hover {
    border-color: var(--accent-color);
    background: rgba(0, 140, 207, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.06);
}
.project-lock-toggle-btn.locked {
    background: #ecfdf5;
    border-color: #10b981;
    border-style: solid;
    color: #047857;
}
.project-lock-toggle-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}
.production-approval-surface-card {
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.production-approval-surface-card:hover {
    transform: translateY(-1px);
}
.production-approval-surface-card.selected {
    border-color: #00a3d7;
    background: #f0fbff;
    box-shadow: 0 0 0 2px rgba(0, 163, 215, 0.12);
}
.production-approval-section {
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    background: #fbfdff;
    padding: 14px;
}
.production-choice-btn {
    min-height: 44px;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    padding: 9px 12px;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.production-choice-btn:hover {
    border-color: #8ecfe8;
}
.production-choice-btn.selected {
    border-color: #00a3d7;
    background: #eefaff;
    color: #007fb3;
    box-shadow: 0 0 0 2px rgba(0, 163, 215, 0.10);
}
.production-tech-hole-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}
.production-tech-hole-preview {
    min-height: 142px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border: 1px dashed #b9dff0;
    border-radius: 14px;
    background: #ffffff;
    padding: 10px;
}
.production-tech-hole-preview.no-media {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
}
.production-tech-hole-preview strong {
    display: block;
    color: #1f2937;
    font-size: 14px;
    margin-bottom: 5px;
}
.production-tech-hole-preview small {
    display: block;
    color: #64748b;
    font-size: 12px;
    line-height: 1.42;
}
.production-tech-hole-preview-img,
.production-tech-hole-preview-placeholder {
    width: 220px;
    height: 124px;
    border-radius: 10px;
    border: 1px solid #d7e0e9;
    object-fit: cover;
    background: #f8fbfd;
}
.production-tech-hole-preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 8px;
    box-sizing: border-box;
}
.header-menu-item.export-disabled {
    opacity: .42;
    cursor: not-allowed;
    filter: grayscale(.35);
}
.header-menu-item.export-disabled:hover {
    background: #f8fbfd;
    color: inherit;
}
.tech-hole-canvas-overlay {
    position: fixed;
    top: calc(var(--header-h, 76px) + 14px);
    right: 20px;
    z-index: 23000;
    width: min(380px, calc(100vw - 40px));
    border: 1px solid #cfe1ef;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
    padding: 14px;
    box-sizing: border-box;
}
.tech-hole-canvas-title {
    color: #1f2937;
    font-size: 15px;
    font-weight: 900;
}
.tech-hole-canvas-subtitle {
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}
.tech-hole-surface-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.tech-hole-surface-buttons button,
.tech-hole-canvas-actions button {
    min-height: 40px;
    border: 1px solid #d7e0e9;
    border-radius: 11px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
}
.tech-hole-surface-buttons button.active {
    border-color: #ff2738;
    background: #fff1f2;
    color: #be123c;
    box-shadow: 0 0 0 2px rgba(255, 39, 56, 0.10);
}
.tech-hole-canvas-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
.tech-hole-canvas-actions button {
    padding: 0 14px;
}
.tech-hole-canvas-actions button.primary {
    border-color: #00a3d7;
    background: #eefaff;
    color: #007fb3;
}
.production-approval-shell {
    display: grid;
    gap: 14px;
}
.production-approval-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}
@media (max-width: 760px) {
    .production-approval-body {
        grid-template-columns: 1fr;
    }
    #production-tech-hole-surface-grid {
        grid-template-columns: 1fr !important;
    }
    .production-approval-options-grid {
        grid-template-columns: 1fr !important;
    }
    .production-approval-surface-card {
        min-height: 170px !important;
    }
    .production-choice-row {
        grid-template-columns: 1fr !important;
    }
    .production-tech-hole-picker,
    .production-tech-hole-preview {
        grid-template-columns: 1fr;
    }
    .production-tech-hole-preview-img,
    .production-tech-hole-preview-placeholder {
        width: 100%;
        height: 112px;
    }
    .tech-hole-surface-buttons {
        grid-template-columns: 1fr;
    }
}
.project-locked .system-btn:disabled,
.project-locked .photo-reference-btn:disabled,
.project-locked .header-menu-item:disabled,
.project-locked .project-name-header-input:disabled,
.project-locked .profile-finish-control select:disabled,
.project-locked .profile-finish-control input:disabled,
.project-locked .profile-finish-control button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}
.pro-only {
    display: none !important;
}
.pro-mode .pro-only {
    display: inline-flex !important;
}
.pro-mode .mobile-action-btn.pro-only {
    display: inline-grid !important;
}
.pro-mode .header-menu-item.pro-only {
    display: flex !important;
}
.pro-mode .production-programs-panel.pro-only {
    display: flex !important;
}
.pro-mode-badge {
    align-items: center;
    margin-left: 12px;
    padding: 8px 14px;
    border: 1px solid #0e94c6;
    border-radius: 999px;
    color: #05658b;
    background: #e8f7fc;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    white-space: nowrap;
}
.pro-logout-btn {
    align-items: center;
    margin-left: 8px;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: #475569;
    background: #fff;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.pro-logout-btn:hover {
    border-color: #0e94c6;
    color: #0e7490;
    background: #f0f9ff;
}
.production-programs-panel {
    margin: 0 0 14px;
    border: 1px solid #bfd7e7;
    border-radius: 14px;
    background: #f7fbfe;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    height: clamp(170px, 28vh, 300px);
    max-height: clamp(170px, 28vh, 300px);
}
.production-programs-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #eef7fb;
    border-bottom: 1px solid #d7e7f2;
}
.production-programs-head strong {
    display: block;
    color: #123244;
    font-size: 13px;
}
.production-programs-head span {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
}
.production-programs-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.production-program-card {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr) minmax(90px, auto);
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid rgba(191, 215, 231, 0.65);
}
.production-program-card:first-of-type {
    border-top: 0;
}
.production-program-id {
    color: #008ccf;
    font-weight: 800;
    font-size: 12px;
}
.production-program-meta {
    color: #1f2937;
    font-size: 12px;
    font-weight: 700;
}
.production-program-segments {
    color: #475569;
    font-size: 11px;
    text-align: right;
    overflow-wrap: anywhere;
    line-height: 1.35;
}
.production-program-values {
    grid-column: 2 / -1;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}
.production-program-values span {
    display: block;
    padding: 7px 9px;
    border: 1px solid #d7e7f2;
    border-radius: 10px;
    background: #ffffff;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.production-program-values b {
    display: block;
    margin-top: 2px;
    color: #111827;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
}
.production-program-details {
    grid-column: 1 / -1;
    color: #64748b;
    font-size: 11px;
    line-height: 1.45;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 8px;
    min-width: 0;
    overflow-wrap: anywhere;
}
.production-program-details span {
    display: inline-flex;
    max-width: 100%;
    padding: 2px 7px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #475569;
    white-space: normal;
}
.header-menu { position: relative; }
.header-icon-btn,
.lang-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    background: #fff;
    border: 2px solid #d3dae3;
    cursor: pointer;
    padding: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #444;
    box-sizing: border-box;
    line-height: 1;
    vertical-align: middle;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.header-icon-btn svg,
.lang-current img,
.lang-current .lang-text-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 0;
    transition: none;
    background: transparent;
    box-sizing: border-box;
    display: block;
}

.header-icon-btn svg {
    padding: 5px;
}

.header-icon-btn:hover,
.header-menu.open .header-icon-btn,
.header-icon-btn.active,
.lang-switcher.open .lang-current,
.lang-current:hover {
    border-color: #008ccf; transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.08);
}
.tutorial-launch-btn {
    position: relative;
}
.tutorial-launch-btn.unseen::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #14b8a6;
    box-shadow: 0 0 0 2px #ffffff;
}
.history-btn:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}
.history-btn:disabled,
.history-btn:disabled:hover {
    border-color: #d3dae3;
    transform: none;
    box-shadow: none;
}
.reset-project-btn {
    color: #64748b;
}
.reset-project-btn:hover {
    color: #dc2626;
    border-color: #fca5a5;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}
.header-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 32px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 12px;
    gap: 12px;
    z-index: 100000;
    border-top: 10px solid transparent;
    background-clip: padding-box;
    min-width: 340px;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
}
.header-menu.open .header-menu-dropdown { display: grid; }

.header-menu-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.header-menu-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7b8b9b;
    padding: 2px 4px 0;
}

.header-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    border: 0;
    background: #fff;
    border-radius: 10px;
    padding: 7px 10px;
    text-align: left;
    cursor: pointer;
    color: #334155;
    font-size: 13px;
    line-height: 1.2;
    transition: background 0.2s ease, color 0.2s ease;
}
.header-menu-item:hover { background: #eef7fb; color: var(--accent-color); }
.header-menu-item:disabled {
    cursor: not-allowed;
    color: #a6b2bd;
    background: #f5f7f9;
}
.header-menu-item:disabled:hover {
    color: #a6b2bd;
    background: #f5f7f9;
}

/* Tryb Zaawansowany Switch */
.switch-container { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.switch {
    position: relative; width: 45px; height: 22px;
    background: #ccc; border-radius: 20px; cursor: pointer;
}
.switch .slider {
    position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    background: #fff; border-radius: 50%; transition: 0.3s;
}
.switch.active { background: var(--accent-color); }
.switch.active .slider { left: 25px; }

/* Przyciski Widoku */
.view-label { color: var(--accent-color); font-weight: bold; font-size: 13px; margin-bottom: 5px; }
.view-btns { display: flex; border: 1px solid var(--border-color); border-radius: 4px; overflow: hidden; }
.view-btns button {
    background: #fff; border: none; padding: 10px 15px; font-size: 12px;
    border-right: 1px solid var(--border-color); cursor: pointer;
}
.view-btns button.active { background: var(--bg-light-blue); color: var(--accent-color); font-weight: bold; }

/* Języki */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-option img {
    width: 30px;height: 30px;border-radius: 50%;
    object-fit: cover;border: 2px solid #ddd;transition: border-color 0.2s, transform 0.2s;
}

.lang-text-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: #fff;
    color: #444;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
    box-sizing: border-box;
    transition: border-color 0.2s, transform 0.2s;
}

.lang-dropdown {
    display: none; position: absolute;right: 0;top: 32px; 
    background: #ffffff;box-shadow: 0 4px 12px rgba(0,0,0,0.15);border-radius: 8px;
    padding: 15px;grid-template-columns: repeat(3, 1fr);gap: 20px;
    z-index: 100000;border-top: 10px solid transparent;background-clip: padding-box;
    min-width: 185px; box-sizing: border-box;
}

.lang-switcher.open .lang-dropdown {
    display: grid;
}

.lang-option {
    cursor: pointer;display: flex;justify-content: center;
}

.lang-option img:hover,
.lang-option .lang-text-badge:hover,
.lang-current .lang-text-badge:hover {
    border-color: #008ccf; transform: scale(1.1);
}
/* --- SIDEBAR --- */
/* Hide the server-rendered skeleton until AppState has applied the final sidebar state. */
body:not(.app-ready) #main-sidebar,
body:not(.app-ready) .secondary-sidebar {
    visibility: hidden;
    opacity: 0;
}

body.app-ready:not(.layout-tablet):not(.layout-mobile) #main-sidebar {
    animation: sidebar-entry-from-header 460ms cubic-bezier(.22, .8, .24, 1) both;
}

body.app-ready:not(.layout-tablet):not(.layout-mobile) .secondary-sidebar.active {
    animation: sidebar-entry-from-header 400ms cubic-bezier(.22, .8, .24, 1) both;
}

@keyframes sidebar-entry-from-header {
    from {
        opacity: 0;
        transform: translateY(-28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.app-ready:not(.layout-tablet):not(.layout-mobile) #main-sidebar,
    body.app-ready:not(.layout-tablet):not(.layout-mobile) .secondary-sidebar.active {
        animation: none;
    }
}

.sidebar {
    background: var(--bg-light-blue);width: var(--sidebar-w);
    min-width: var(--sidebar-w);max-width: var(--sidebar-w);display: flex;
    flex-direction: column;border-right: 1px solid var(--border-color);
    padding: 15px;
    overflow: visible;position: relative;z-index: 2500;
    min-height: 0;
    height: calc(100% - var(--footer-h));
    max-height: calc(100% - var(--footer-h));
}

#main-sidebar {
    z-index: 2500;
}

.sidebar-main-controls {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.primary-selection-layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 10px;
}

.primary-selection-buttons {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.sidebar-default-selection-group {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    gap: 0;
    width: 100%;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
}

.fiszka-card {
    position: relative;
    background: #f8fafc;
    border: none;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    padding: 12px 16px 12px 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    width: 100%;
    height: fit-content;
    box-sizing: border-box;
    flex-shrink: 0;
}

.fiszka-card:last-child {
    border-bottom: none;
}

.fiszka-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: #00bcff;
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.fiszka-card:hover {
    background: #f1f5f9;
}

.fiszka-card:hover::before {
    transform: scaleY(0.5);
}

/* Active Drawer State (when modal is currently open) */
.fiszka-card.active {
    background: #e0f2fe !important;
}

.fiszka-card.active::before {
    transform: scaleY(1) !important;
    background: #00bcff !important;
}

/* 1. Inactive/Disabled step: Grey text, normal font weight, no ribbon */
.fiszka-card.step-disabled {
    background: #f8fafc;
    cursor: not-allowed;
    pointer-events: none;
}

.fiszka-card.step-disabled .fiszka-value {
    color: #94a3b8;
    font-weight: 500;
}

.fiszka-card.step-disabled::before {
    display: none;
}

/* 2. Active Step (next step to click): Black bold text, has ribbon */
.fiszka-card.step-active {
    background: #ffffff;
    cursor: pointer;
    pointer-events: auto;
}

.fiszka-card.step-active .fiszka-value {
    color: #0f172a;
    font-weight: 800; /* Bold */
}

.fiszka-card.step-active::before {
    transform: scaleY(1);
    background: #00bcff;
}

/* 3. Selected Step: Black normal text, has ribbon indicating configured status */
.fiszka-card.step-selected {
    background: #ffffff;
    cursor: pointer;
    pointer-events: auto;
}

.fiszka-card.step-selected .fiszka-value {
    color: #0f172a;
    font-weight: 500; /* Normal weight */
}

.fiszka-card.step-selected::before {
    transform: scaleY(1);
    background: #00bcff;
}

.fiszka-category {
    font-size: 10px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    pointer-events: none;
}

.fiszka-value {
    font-size: 13px;
    line-height: 1.25;
    word-break: break-word;
    pointer-events: none;
    transition: font-weight 0.2s ease, color 0.2s ease;
}

.compact-trigger {
    min-height: 42px;
    padding: 9px 8px;
    line-height: 1.25;
    margin: 0;
}

.profile-section-preview {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    align-items: center;
    justify-items: center;
    gap: 4px;
    align-self: start;
    min-height: 0;
    padding: 8px 6px;
    border: 1px solid #dbe5ee;
    border-radius: 10px;
    background: #ffffff;
}

.sidebar-profile-visual {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    overflow: hidden;
}


.sidebar-profile-visual img {
    max-width: 76px;
    max-height: 72px;
    object-fit: contain;
    display: block;
}

.sidebar-profile-meta {
    color: #536374;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    min-height: 14px;
}

.sidebar-cover-options {
    width: 100%;
    border-top: 1px solid #eef3f7;
    padding-top: 4px;
    color: #24313f;
    font-size: 9px;
    line-height: 1.2;
    text-align: center;
}

.sidebar-cover-options .cover-label {
    display: block;
    color: #7a8a9a;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.sidebar-cover-options .cover-value {
    font-weight: 700;
}

.sidebar-cover-options.empty .cover-value {
    color: #a0acb8;
    font-weight: 600;
}

.sidebar-tolerance-info {
    align-self: stretch;
    margin: 8px 6px 0;
    border: 1px solid #d8edf8;
    background: #f6fbfe;
    border-radius: 9px;
    padding: 5px 10px;
    color: #0079b4;
    font-size: 10px;
    line-height: 1.2;
    text-align: left;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-tolerance-info .tolerance-label {
    color: #7a8a9a;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 0;
}

.sidebar-tolerance-info .tolerance-value {
    white-space: nowrap;
}

.sidebar-segments-zone {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    position: relative;
    gap: 8px;
}

.sidebar-default-selection-group .sidebar-segments-zone.expanded {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* Styl dla drugiego sidebara */
.secondary-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--sidebar-w);
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    max-height: calc(100% - var(--footer-h));
    padding: 15px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    background: #fff; /* Nieco jasniejszy, by odroznic od glownego */
    border-top: 1px solid #d9e1e8;
    border-right: 1px solid #ddd;
    box-sizing: border-box;
    box-shadow: 0 -2px 8px rgba(28, 39, 49, 0.08);
    transform: translateX(-12px);
    transition: transform 0.32s ease, opacity 0.2s ease, border-color 0.32s ease, box-shadow 0.32s ease;
    z-index: 1100;
}

.secondary-sidebar.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.secondary-sidebar.collapsed {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-12px);
    border-right-color: transparent;
}

.system-btn {
    background: #fff; border: 1px solid var(--border-color); width: 100%;
    padding: 12px; margin-bottom: 8px; border-radius: 4px; cursor: pointer;
    font-size: 13px; color: #444; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.system-btn:hover { background: #fdfdfd; border-color: var(--accent-color); }

.selection-visual-empty::before {
    content: none;
}

.sidebar-divider { border: 0; border-top: 1px solid var(--border-color); margin: 10px -10px; }
.section-title { font-size: 11px; color: #888; margin-bottom: 10px; text-transform: uppercase; }

/* Segmenty */
.segments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 4px;
    scroll-behavior: smooth;
}
.segment-item {
    background: #fff; border: 1px solid var(--border-color); padding: 10px;
    border-radius: 4px; cursor: var(--cursor-lumines-arrow), auto !important; transition: 0.2s;
}
.segment-item.active { border-left: 5px solid var(--accent-color); background: #f0f7ff; border-color: var(--accent-color); }
.project-locked .segment-item,
.segment-item.locked {
    cursor: var(--cursor-lumines-arrow), auto !important;
}
.project-locked .segment-item:not(.active):hover,
.segment-item.locked:not(.active):hover {
    border-color: var(--border-color);
    background: #fff;
}
.project-locked .seg-edit,
.segment-item.locked .seg-edit {
    opacity: 0.18;
    pointer-events: none;
    cursor: var(--cursor-lumines-arrow), auto !important;
}
.segments-list .segment-item,
.segments-list .segment-item *,
.segments-list .seg-edit {
    cursor: var(--cursor-lumines-arrow), auto !important;
}
.segment-header { display: flex; justify-content: space-between; font-size: 12px; gap: 8px; }
.seg-name-container { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.seg-collision-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 999px;
    background: #fff4c2; color: #a66b00; font-size: 12px; line-height: 1;
    border: 1px solid #f0c44a; flex: 0 0 auto;
}
.segment-details { display: flex; gap: 10px; color: #666; font-size: 11px; margin-top: 4px; }

.segment-params-panel {
    display: grid;
    gap: 10px;
}

.segment-params-title,
.segment-control-label {
    font-size: 11px;
    color: #667789;
}

.segment-params-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.segment-bend-control {
    flex: 1 1 auto;
    min-width: 0;
}

.segment-bend-btn {
    width: 100%;
    background: #fff;
    margin-top: 5px;
}

.segment-control-group {
    margin-bottom: 12px;
}

.segment-control-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.segment-control-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.segment-control-copy label {
    font-size: 12px;
}

.segment-control-input {
    width: 74px;
    text-align: right;
    border: 1px solid #ccc;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.segment-control-slider {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}

.segment-control-slider::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: #d8e6f0;
}

.segment-control-slider::-moz-range-track {
    height: 5px;
    border-radius: 999px;
    background: #d8e6f0;
}

.angle-btns {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    margin-top: 5px;
}

.angle-btns .system-btn {
    font-size: 11px;
    padding: 6px 0;
    margin-bottom: 0;
}

.segment-params-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.segment-params-actions .system-btn {
    flex: 1;
}

.segment-remove-btn {
    color: red;
}

.segment-action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    flex: 0 0 auto;
    align-items: stretch;
    width: 100%;
}

.segments-onboarding {
    display: grid;
    gap: 10px;
    margin-top: 2px;
}

.segments-onboarding-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid #d7e0e9;
    border-radius: 10px;
    background: #ffffff;
    transition: opacity 0.2s, background 0.2s, border-color 0.2s;
}

.segments-onboarding-item.done {
    background: #f8fbfd;
    border-color: #e3ecf3;
    opacity: 0.7;
}

.segments-onboarding-index {
    color: #008ccf;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.segments-onboarding-title {
    color: #24313f;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.segments-onboarding-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.segments-onboarding-status {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.segments-onboarding-status {
    border: 1px solid #d7e7f2;
    background: #ffffff;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
}

.segments-onboarding-status.done {
    border-color: #bde7cf;
    background: #effaf3;
    color: #16a34a;
}

.segments-onboarding-status.pending {
    border-color: #d7e7f2;
    background: #ffffff;
    color: #9aa8b8;
}

.segments-onboarding-status svg {
    width: 16px;
    height: 16px;
    display: block;
}


.add-seg-btn,
.duplicate-seg-btn,
.template-seg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 12px;
    margin: 0;
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--accent-color);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

#duplicate-seg-btn {
    display: none;
}

.add-seg-btn {
    width: 100%;
    flex: 0 0 auto;
    font-weight: 800;
}

.add-seg-btn:hover:not(:disabled),
.duplicate-seg-btn:hover:not(:disabled),
.template-seg-btn:hover:not(:disabled) {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(0, 140, 207, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.06);
}

.duplicate-seg-btn:disabled,
.template-seg-btn:disabled,
.add-seg-btn:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.shape-template-grid {
    display: grid;
    grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1fr);
    gap: 16px;
}

.close-shape-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.close-shape-card {
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    background: #fff;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.close-shape-card.disabled {
    opacity: 0.68;
}

.close-shape-preview {
    width: 100%;
    height: 190px;
    border: 1px solid #e1e9f0;
    border-radius: 12px;
    background: #f8fbfd;
}

.close-shape-card-title {
    font-weight: 800;
    color: #1f2937;
}

.close-shape-card-desc,
.close-shape-card-status {
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

.close-shape-card-status {
    min-height: 34px;
    color: #0f6f9f;
    font-weight: 700;
}

.close-shape-card.disabled .close-shape-card-status {
    color: #b45309;
}

.close-shape-apply-btn {
    width: 100%;
    margin: 0;
    padding: 10px 14px;
    background: #eef7fb;
    border-color: #b9dff0;
    color: #008ccf;
}

.close-shape-apply-btn:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.shape-template-list {
    display: grid;
    gap: 8px;
    align-content: start;
}

.shape-template-card {
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    background: #fff;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    color: #253342;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.shape-template-card-content {
    flex: 1;
}

.shape-template-card-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667789;
    transition: color 0.18s ease;
}

.shape-template-card.active .shape-template-card-icon,
.shape-template-card:hover .shape-template-card-icon {
    color: #008ccf;
}

.shape-template-card.active,
.shape-template-card:hover {
    border-color: #008ccf;
    background: #f4fbff;
    box-shadow: 0 8px 20px rgba(0, 140, 207, 0.08);
}

.shape-template-card strong {
    display: block;
    font-size: 14px;
}

.shape-template-card span {
    display: block;
    margin-top: 4px;
    color: #667789;
    font-size: 11px;
    line-height: 1.35;
}

.shape-template-form {
    display: grid;
    gap: 12px;
}

.shape-template-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.shape-template-field label {
    display: block;
    margin-bottom: 5px;
    color: #596b7e;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.shape-template-field input,
.shape-template-field select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    padding: 10px 12px;
    color: #1f2937;
    font: 13px/1.3 var(--font-main);
}

.shape-template-preview {
    width: 100%;
    height: 190px;
    border: 1px solid #d7e0e9;
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
        linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
        #f8fbfd;
    background-size: 24px 24px;
}

.shape-template-warning {
    min-height: 18px;
    color: #b45309;
    font-size: 12px;
    line-height: 1.4;
}

.shape-template-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- DRAWERS (SZUFLADY) --- */
.drawer-modal {
    position: absolute; left: 100%; top: 0; height: auto; max-height: 100%; width: auto; min-width: 320px; max-width: min(1240px, calc(100vw - 36px));
    background: #fff; box-shadow: 10px 0 20px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color); border-left: solid #008ccf;
    display: none; flex-direction: column; z-index: 9000; border-radius: 0 8px 8px 0;
    box-sizing: border-box;
}
.drawer-modal.open { display: flex; animation: slideIn 0.2s ease-out; }
.drawer-header { padding: 15px; background: #f8f9fa; border-bottom: 1px solid var(--border-color); font-weight: bold; display: flex; justify-content: space-between; flex-shrink: 0; }
.drawer-content { padding: 12px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }

#profile-modal {
    max-width: min(1540px, calc(100vw - 18px));
}

#orientation-modal {
    width: max-content;
    max-width: min(942px, calc(100vw - 18px));
}

#orientation-modal.has-flip-option {
    width: max-content;
    max-width: min(1168px, calc(100vw - 18px));
}

#bend-modal {
    max-width: min(1400px, calc(100vw - 18px));
}

.profile-gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 220px);
    gap: 16px;
    justify-content: start;
}

.orientations-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 210px);
    gap: 16px;
    justify-content: start;
    overflow-x: hidden;
}

#orientation-modal.has-flip-option .orientations-gallery-grid {
    grid-template-columns: repeat(5, 210px);
}

.bend-gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, 210px);
    gap: 16px;
    justify-content: start;
}

.bend-gallery-grid.three-grid {
    grid-template-columns: repeat(3, 210px);
}

.bend-gallery-grid.four-grid {
    grid-template-columns: repeat(4, 210px);
}

.bend-gallery-grid.six-grid {
    grid-template-columns: repeat(6, 210px);
}

.profile-card {
    border: 1px solid #d7e0e9;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-radius: 16px;
    display: grid;
    gap: 8px;
    align-content: start;
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
    box-shadow: 0 10px 20px rgba(25, 39, 52, 0.04);
    min-width: 0;
}
.profile-card:hover { border-color: var(--accent-color); }
.profile-card.active {
    border-color: #8bd7f6;
    box-shadow: 0 0 0 3px rgba(0, 188, 255, 0.12);
}

.orientation-flip-card {
    border-style: dashed;
    background: linear-gradient(180deg, #f8fbfd 0%, #ffffff 100%);
}

.orientation-flip-card:hover {
    background: #eef8fd;
}

.orientation-flip-visual svg {
    width: 170px;
    max-width: 100%;
    height: auto;
}

.flip-profile-body {
    fill: #f8fafc;
    stroke: #334155;
    stroke-width: 5;
    stroke-linejoin: round;
}

.flip-profile-light {
    fill: none;
    stroke: #ffd166;
    stroke-width: 8;
    stroke-linecap: round;
}

.flip-profile-arrow,
.flip-profile-arrow-head {
    fill: none;
    stroke: #008ccf;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.drawer-card-brand {
    display: flex;
    justify-content: flex-end;
    min-height: 24px;
}

.drawer-card-brand img {
    width: 72px;
    height: auto;
    object-fit: contain;
}

.drawer-card-visual {
    background: #ffffff;
    border-radius: 14px;
    padding: 10px;
    min-height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #233140;
    line-height: 1.15;
}

.drawer-card-subtitle {
    font-size: 11px;
    color: #7d8b99;
    line-height: 1.3;
}

.drawer-card-meta {
    display: grid;
    gap: 6px;
    margin-top: 4px;
    text-align: left;
}

.drawer-card-info-btn {
    display: none;
}

.drawer-mobile-info .drawer-card-meta {
    display: grid;
}

.drawer-mobile-info .drawer-meta-line {
    margin-bottom: 8px;
}

.drawer-card-meta .drawer-meta-line-list {
    background: #ffffff;
}

.drawer-meta-line {
    display: grid;
    gap: 3px;
    padding: 8px 9px;
    border-radius: 12px;
    background: #f3f7fa;
    border: 1px solid #e1e8ef;
}

.drawer-meta-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7a8a99;
}

.drawer-meta-line strong {
    font-size: 11px;
    font-weight: 600;
    color: #536374;
}

.drawer-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.drawer-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef7fb;
    color: #476072;
    font-size: 10px;
    line-height: 1.2;
    border: 1px solid #dbe9f2;
}

.drawer-emphasis-yes {
    font-weight: 700;
    color: #233140;
}

.drawer-bend-limit-table {
    display: grid;
    gap: 4px;
    margin-top: 2px;
}

.drawer-bend-limit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 7px;
    border-radius: 10px;
    background: #f7fafc;
    color: #536374;
    font-size: 9.5px;
    line-height: 1.18;
}

.drawer-bend-limit-row.available {
    background: #eef7fb;
    border: 1px solid #dbe9f2;
}

.drawer-bend-limit-row.unavailable {
    opacity: 0.52;
}

.drawer-bend-limit-row span {
    white-space: normal;
    overflow-wrap: anywhere;
}

.drawer-bend-limit-row strong {
    color: #233140;
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
}

.drawer-emphasis-no {
    font-weight: 400;
    color: #536374;
}

.compatibility-modal {
    display: grid;
    gap: 16px;
}

.compatibility-summary {
    font-size: 14px;
    color: #516171;
    line-height: 1.5;
}

.compatibility-issues {
    display: grid;
    gap: 12px;
    max-height: min(48vh, 420px);
    overflow: auto;
    padding-right: 4px;
}

.compatibility-issue-card {
    border: 1px solid #dbe5ee;
    border-radius: 14px;
    padding: 14px 16px;
    background: #f8fbfd;
}

.compatibility-issue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.compatibility-issue-header strong {
    font-size: 15px;
    color: #223140;
}

.compatibility-issue-header span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7b8a99;
}

.compatibility-issue-list {
    margin: 0;
    padding-left: 18px;
    color: #4f6070;
    font-size: 13px;
    line-height: 1.5;
}

.compatibility-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.compatibility-action-btn {
    width: auto;
    margin: 0;
    padding: 10px 16px;
}

.compatibility-action-cancel {
    color: #526273;
}

.compatibility-action-remove {
    color: #b42318;
    border-color: #f1c0ba;
    background: #fff7f6;
}

/* Montaż */
.mounting-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.mounting-card { border: 1px solid var(--border-color); padding: 10px; text-align: center; border-radius: 6px; cursor: pointer; }
.mounting-card.active { border-color: var(--accent-color); background: var(--bg-light-blue); }
.surface-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.surface-btns button { padding: 8px; font-size: 11px; border: 1px solid var(--border-color); background: #fff; cursor: pointer; }
.surface-btns button.active { background: var(--accent-color); color: #fff; }

/* --- VIEWPORT 3D --- */
#viewport-3d { flex: 1 1 auto; min-width: 0; position: relative; background: #f1f1ee; overflow: hidden; }
#canvas-holder { width: 100%; height: 100%; position: absolute; top: 0; left: 0; background: #f1f1ee; overflow: hidden; }
#canvas-holder canvas { touch-action: none; }
.canvas-renderer-error {
    width: 100%;
    height: 100%;
    display: grid;
    place-content: center;
    gap: 8px;
    padding: 24px;
    box-sizing: border-box;
    text-align: center;
    color: #304255;
    background: #f1f1ee;
}

.canvas-renderer-error strong {
    font-size: 18px;
}

.canvas-renderer-error span {
    max-width: 420px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}
#canvas-holder.canvas-resize-freeze canvas { display: block; }
#canvas-tools {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.canvas-view-mode-btn {
    background: #fff;
    border: 1px solid #ccc;
    min-width: 100px;
    height: 45px;
    padding: 0 14px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.canvas-projection-btn {
    width: 100px;
    min-width: 100px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #111827;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.canvas-projection-btn:hover,
.canvas-projection-btn:focus-visible {
    border-color: #94a3b8;
    background: #f8fafc;
    outline: none;
}

.canvas-projection-btn.active {
    border-color: #f2c94c;
    background: #fff8df;
    color: #d89b00;
}

.view-preset-control {
    display: grid;
    grid-template-columns: repeat(3, 28px);
    grid-template-rows: repeat(3, 28px);
    gap: 3px;
    padding: 5px;
    border: 0;
    clip-path: polygon(13% 0, 87% 0, 100% 13%, 100% 87%, 87% 100%, 13% 100%, 0 87%, 0 13%);
    background: #ffffff;
    filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.12));
}

.view-preset-tile {
    position: relative;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    color: #4b5f73;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
    touch-action: manipulation;
}

.view-preset-tile:hover,
.view-preset-tile:focus-visible {
    z-index: 1;
    border-color: #94a3b8;
    background: #f8fafc;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, .12);
    outline: none;
}

.view-preset-tile:active {
    transform: scale(.94);
}

.view-preset-tile.is-active {
    border-color: #f2c94c;
    background: #fff8df;
    color: #d89b00;
    box-shadow: inset 0 0 0 2px rgba(242, 201, 76, .18);
}

.view-preset-tile.is-active::after {
    color: #d89b00;
}

.view-preset-diagonal {
    border: 0;
    border-radius: 4px;
    background: #cbd5e1;
}

.view-preset-diagonal-nw { clip-path: polygon(0 100%, 100% 0, 100% 100%); }
.view-preset-diagonal-ne { clip-path: polygon(0 0, 0 100%, 100% 100%); }
.view-preset-diagonal-sw { clip-path: polygon(0 0, 100% 0, 100% 100%); }
.view-preset-diagonal-se { clip-path: polygon(0 0, 0 100%, 100% 0); }

.view-preset-diagonal::before {
    content: '';
    position: absolute;
    inset: 2px;
    pointer-events: none;
    background: #ffffff;
}

.view-preset-diagonal-nw::before { clip-path: polygon(0 100%, 100% 0, 100% 100%); }
.view-preset-diagonal-ne::before { clip-path: polygon(0 0, 0 100%, 100% 100%); }
.view-preset-diagonal-sw::before { clip-path: polygon(0 0, 100% 0, 100% 100%); }
.view-preset-diagonal-se::before { clip-path: polygon(0 0, 0 100%, 100% 0); }

.view-preset-diagonal:hover,
.view-preset-diagonal:focus-visible {
    background: #94a3b8;
}

.view-preset-diagonal.is-active {
    background: #f2c94c;
}

.view-preset-diagonal.is-active::before {
    background: #fff8df;
}

.view-preset-diagonal:active { filter: brightness(.96); }

.view-preset-center::after {
    content: '↕';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #5f7890;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.view-preset-square[data-view-preset="front"]::after,
.view-preset-square[data-view-preset="back"]::after,
.view-preset-square[data-view-preset="left"]::after,
.view-preset-square[data-view-preset="right"]::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-style: solid;
    border-width: 2px 0 0 2px;
    border-color: currentColor;
    color: #5f7890;
}

.view-preset-square[data-view-preset="front"]::before,
.view-preset-square[data-view-preset="back"]::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 7px;
    width: 2px;
    height: 13px;
    border-radius: 1px;
    background: currentColor;
}

.view-preset-square[data-view-preset="left"]::before,
.view-preset-square[data-view-preset="right"]::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 13px;
    width: 13px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}

.view-preset-square[data-view-preset="front"]::after {
    left: 10px;
    top: 6px;
    transform: rotate(45deg);
}

.view-preset-square[data-view-preset="back"]::after {
    left: 10px;
    top: 14px;
    transform: rotate(225deg);
}

.view-preset-square[data-view-preset="left"]::after {
    left: 6px;
    top: 10px;
    transform: rotate(-45deg);
}

.view-preset-square[data-view-preset="right"]::after {
    left: 14px;
    top: 10px;
    transform: rotate(135deg);
}

.sidebar-pdf-export-btn {
    align-self: center;
    width: calc(100% - 12px);
    margin: 12px 6px 5px;
    min-height: 40px;
    border-radius: 10px;
    background: #eef7fb;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.canvas-tool-drawer {
    display: grid;
    justify-items: end;
    gap: 8px;
    position: relative;
}

.canvas-tool-drawer-trigger,
.canvas-tool-btn {
    background: #fff;
    border: 1px solid #ccc;
    width: 45px;
    height: 45px;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    color: #4a5a6a;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
    touch-action: manipulation;
}

.canvas-tool-drawer-trigger {
    color: #4a5a6a;
}

.canvas-tool-drawer-trigger svg {
    width: 22px;
    height: 22px;
}

.canvas-tool-drawer-list {
    display: grid;
    justify-items: end;
    gap: 7px;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.canvas-tool-drawer-list::before {
    content: "";
    position: absolute;
    top: -10px;
    right: 0;
    width: 100%;
    height: 10px;
}

.canvas-tool-drawer.is-open .canvas-tool-drawer-list {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.canvas-tool-drawer-list .canvas-tool-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 45px;
    height: 45px;
    overflow: hidden;
    transition:
        width 0.18s ease,
        opacity 0.18s ease;
}

.canvas-tool-inline-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    cursor: pointer;
}

.canvas-tool-inline-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.canvas-tool-inline-slider {
    position: relative;
    width: 42px;
    height: 24px;
    border: 1px solid #cbd8e4;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.canvas-tool-inline-slider::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
    transition: transform 0.18s ease;
}

.canvas-tool-inline-switch input:checked + .canvas-tool-inline-slider {
    border-color: #00a3d7;
    background: #00a3d7;
}

.canvas-tool-inline-switch input:checked + .canvas-tool-inline-slider::after {
    transform: translateX(18px);
}

.canvas-tool-inline-switch input:disabled + .canvas-tool-inline-slider {
    opacity: 0.45;
}

.canvas-tool-drawer-list .canvas-tool-btn {
    width: 218px;
    justify-content: flex-start;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}

.canvas-tool-drawer-list .canvas-tool-btn::after {
    content: attr(aria-label);
    font-size: 12px;
    font-weight: 700;
    color: currentColor;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.canvas-tool-drawer.is-open .canvas-tool-wrapper {
    width: 218px;
}

.canvas-tool-drawer.is-open .canvas-tool-btn::after {
    opacity: 1;
}

#canvas-tools .canvas-tool-drawer.geometry-gated-tool {
    opacity: 0;
    width: 0;
    min-width: 0;
    padding: 0;
    border-width: 0;
    transform: translateY(-26px);
    pointer-events: none;
    overflow: hidden;
    box-shadow: none;
    transition:
        opacity 0.46s ease,
        width 0.32s ease,
        padding 0.32s ease,
        border-width 0.24s ease,
        transform 0.52s cubic-bezier(.22,.8,.24,1),
        border-color 0.18s ease,
        color 0.18s ease,
        background 0.18s ease;
    transition-delay: var(--tool-delay, 0ms);
}

#viewport-3d.canvas-tools-armed #canvas-tools .canvas-tool-drawer.geometry-gated-tool {
    opacity: 1;
    width: 45px;
    padding: 0;
    border-width: 1px;
    transform: translateY(0);
    pointer-events: auto;
    overflow: visible;
}

.local-dimension-controls,
.shape-rotation-controls,
.suspension-controls {
    position: absolute;
    top: 70px;
    right: 86px;
    z-index: 99;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px;
    border: 1px solid #cfe1ef;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    max-width: calc(100vw - 136px);
    overflow-x: auto;
    scrollbar-width: thin;
}

.local-dimension-controls {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 8px;
    min-width: 280px;
}

.shape-rotation-controls {
    top: 12px;
    left: 50%;
    right: auto;
    transform: translate(-50%, -12px);
    align-items: stretch;
    gap: 8px;
}

.suspension-controls {
    top: 12px;
    left: 50%;
    right: auto;
    transform: translate(-50%, -12px);
    align-items: center;
    gap: 7px;
}

.local-dimension-controls.active,
.shape-rotation-controls.active,
.suspension-controls.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.shape-rotation-controls.active,
.suspension-controls.active {
    transform: translateX(-50%);
}

.local-dimension-controls-label,
.suspension-controls-label {
    padding: 0 7px;
    color: #5b6d80;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.local-dimension-controls button,
.shape-rotation-controls button,
.suspension-controls button {
    height: 28px;
    padding: 0 10px;
    border: 1px solid #cbd8e4;
    border-radius: 999px;
    background: #fff;
    color: #243447;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.suspension-controls button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.suspension-controls button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.local-dimension-controls button:hover,
.local-dimension-controls button.active,
.shape-rotation-controls button:hover,
.shape-rotation-controls button.active,
.suspension-controls button:hover,
.suspension-controls button.active {
    border-color: #008ccf;
    color: #0074ad;
    background: #eaf7ff;
}

.local-dimension-controls button:disabled,
.shape-rotation-controls button:disabled,
.suspension-controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f8fafc;
    color: #94a3b8;
}

.shape-rotation-value {
    min-width: 36px;
    color: #008ccf;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.shape-rotation-axis {
    --axis-color: #008ccf;
    display: grid;
    grid-template-columns: 22px 28px 92px 38px 28px;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 0 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--axis-color) 9%, #ffffff);
    border: 1px solid color-mix(in srgb, var(--axis-color) 34%, #d9e4ec);
}

.shape-rotation-axis.axis-x {
    --axis-color: #e53935;
}

.shape-rotation-axis.axis-y {
    --axis-color: #16a34a;
}

.shape-rotation-axis.axis-z {
    --axis-color: #2563eb;
}

.shape-rotation-axis-label {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--axis-color);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.shape-rotation-axis .shape-rotation-value {
    color: var(--axis-color);
}

.shape-rotation-axis button {
    width: 28px;
    min-width: 28px;
    padding: 0;
    color: var(--axis-color);
    border-color: color-mix(in srgb, var(--axis-color) 42%, #d7e2ea);
}

.shape-rotation-slider {
    width: 92px;
    height: 18px;
    accent-color: var(--axis-color);
    cursor: pointer;
}

.shape-rotation-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--axis-color) 34%, #dbe7ef);
}

.shape-rotation-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--axis-color);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
}

.shape-rotation-slider::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--axis-color) 34%, #dbe7ef);
}

.shape-rotation-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--axis-color);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
}

.canvas-tool-btn svg {
    width: 22px;
    height: 22px;
}

.canvas-tool-btn.active {
    color: #d89b00;
    border-color: #f2c94c;
    background: #fff8df;
}
.canvas-custom-tooltip {
    position: fixed;
    z-index: 9999;
    background: #1e293b;
    color: #f8fafc;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.4;
    max-width: 260px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: pre-line;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.canvas-tool-btn:disabled,
#photo-reference-btn:disabled {
    opacity: 0.34;
    cursor: not-allowed;
    filter: grayscale(1);
    box-shadow: none;
    pointer-events: none; /* Let events bubble up to the wrapper */
}
.canvas-tool-btn:disabled:hover,
#photo-reference-btn:disabled:hover {
    transform: none;
    border-color: #ccc;
    color: #4a5a6a;
    background: #fff;
}

.presentation-mode {
    grid-template-rows: 0 minmax(0, 1fr) 0;
}

.presentation-mode #content-wrapper {
    grid-row: 1 / -1;
    height: 100vh;
}

.presentation-mode .header,
.presentation-mode #main-sidebar,
.presentation-mode #params-sidebar,
.presentation-mode #app_footer,
.presentation-mode #canvas-tools,
.presentation-mode #local-dimension-controls,
.presentation-mode #shape-rotation-controls,
.presentation-mode #suspension-controls,
.presentation-mode #canvas-help-btn {
    display: none !important;
}

.presentation-mode #viewport-3d {
    flex: 1 1 auto;
}

.presentation-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 250;
    pointer-events: none;
}

.presentation-mode .presentation-overlay {
    display: block;
}

.presentation-info-card {
    position: absolute;
    left: 20px;
    top: 20px;
    width: min(300px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid rgba(209, 225, 238, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(12px);
    transition: opacity 0.26s ease, transform 0.26s ease;
}

.presentation-kicker {
    color: #008ccf;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.presentation-info-card h2 {
    margin: 6px 0 14px;
    color: #152333;
    font-size: 28px;
    line-height: 1.05;
}

.presentation-meta-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.presentation-meta-item {
    min-width: 0;
    min-height: 58px;
    padding: 11px 13px;
    border: 1px solid #dbe6ef;
    border-radius: 10px;
    background: rgba(247, 251, 254, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.presentation-meta-item span {
    display: block;
    color: #6b7f93;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.presentation-meta-item strong {
    display: block;
    margin-top: 5px;
    color: #172331;
    font-size: 15px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.presentation-exit-btn {
    position: absolute;
    right: 28px;
    top: 28px;
    pointer-events: auto;
    border: 1px solid #cfe2ef;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #172331;
    padding: 11px 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
    transition: opacity 0.26s ease, transform 0.26s ease, background 0.2s ease, border-color 0.2s ease;
}

.presentation-exit-btn:hover {
    border-color: #008ccf;
    color: #008ccf;
}

.presentation-tool-strip {
    position: absolute;
    right: 28px;
    bottom: 28px;
    display: inline-flex;
    gap: 10px;
    pointer-events: auto;
    transition: opacity 0.26s ease, transform 0.26s ease;
}

.presentation-mode.presentation-ui-idle .presentation-info-card,
.presentation-mode.presentation-ui-idle .presentation-exit-btn,
.presentation-mode.presentation-ui-idle .presentation-tool-strip {
    opacity: 0;
    pointer-events: none;
}

.presentation-mode.presentation-ui-idle .presentation-info-card {
    transform: translateX(-12px);
}

.presentation-mode.presentation-ui-idle .presentation-exit-btn {
    transform: translateY(-10px);
}

.presentation-mode.presentation-ui-idle .presentation-tool-strip {
    transform: translateY(12px);
}

.presentation-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid #cfe2ef;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #4a5a6a;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(10px);
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.presentation-tool-btn:hover,
.presentation-tool-btn.active {
    border-color: #f2c94c;
    color: #d89b00;
    background: rgba(255, 248, 223, 0.94);
    transform: translateY(-1px);
}

.presentation-tool-btn svg {
    width: 23px;
    height: 23px;
}

.presentation-mode #photo-reference-btn,
.presentation-mode #photo-reference-panel {
    display: none !important;
}

.calculation-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%) scale(0.95);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(480px, calc(100vw - 40px));
    padding: 16px 24px;
    border-radius: 16px;
    background: rgba(238, 247, 251, 0.95);
    border: 1px solid #b9dff0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #0f4d66;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 20px 40px rgba(15, 77, 102, 0.22);
    opacity: 0;
    pointer-events: none;
    z-index: 10000;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.calculation-toast.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.calculation-toast-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(0, 140, 207, 0.2);
    border-top: 3px solid #008ccf;
    border-radius: 50%;
    animation: calculation-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes calculation-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.calculation-toast-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #008ccf;
    box-shadow: 0 0 0 0 rgba(0, 140, 207, 0.42);
    animation: calculationPulse 1.2s infinite;
    flex: 0 0 auto;
}

@keyframes calculationPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 140, 207, 0.42); }
    70% { box-shadow: 0 0 0 9px rgba(0, 140, 207, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 140, 207, 0); }
}

#toggle-helpers { background: #fff; border: 1px solid var(--border-color); width: 45px; height: 45px; cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
#canvas-help-btn {
    position: absolute;
    right: 18px;
    z-index: 120;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid #d3dae3;
    background: rgba(255,255,255,0.95);
    color: #4a5a6a;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(25,39,52,0.08);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, bottom 0.22s ease;
}

#canvas-help-btn {
    bottom: calc(18px + var(--footer-h, 0px));
}

#canvas-photo-ref-shortcut-btn {
    position: absolute;
    right: 76px;
    bottom: calc(18px + var(--footer-h, 0px));
    z-index: 120;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid #d3dae3;
    background: rgba(255,255,255,0.95);
    color: #4a5a6a;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(25,39,52,0.08);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, bottom 0.22s ease;
}

#canvas-photo-ref-shortcut-btn.active {
    color: #d89b00 !important;
    border-color: #f2c94c !important;
    background: #fff8df !important;
}

body.material-panel-fullscreen #canvas-help-btn,
body.material-panel-fullscreen #canvas-photo-ref-shortcut-btn {
    display: none !important;
}

#canvas-photo-ref-shortcut-btn:hover {
    transform: translateY(-1px);
    border-color: #008ccf;
    color: #008ccf;
}

#canvas-help-btn:hover {
    transform: translateY(-1px);
    border-color: #008ccf;
    color: #008ccf;
}

#canvas-help-btn svg {
    width: 28px;
    height: 28px;
}

.photo-reference-panel {
    position: absolute;
    right: 84px;
    bottom: 82px;
    z-index: 130;
    width: 380px;
    display: none;
    gap: 12px;
    background: rgba(255,255,255,0.97);
    border: 1px solid #d3dae3;
    border-radius: 16px;
    box-shadow: 0 16px 34px rgba(25,39,52,0.14);
    padding: 14px;
    color: #24313f;
}

.photo-reference-panel.open {
    display: grid;
}

.photo-reference-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.photo-reference-header strong {
    display: block;
    font-size: 14px;
    color: #172331;
}

.photo-reference-header span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
    color: #64748b;
}

.photo-reference-close {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.photo-reference-actions,
.photo-reference-toggles {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.photo-reference-btn {
    border: 1px solid #b9dff0;
    background: #eef7fb;
    color: #008ccf;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.photo-reference-btn.secondary {
    border-color: #d7e0e9;
    background: #ffffff;
    color: #475569;
}

.photo-reference-btn.danger {
    border-color: #fecdd3;
    background: #fff1f2;
    color: #dc2626;
}

.photo-reference-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.photo-reference-disabled-hint {
    margin-top: 7px;
    padding: 8px 10px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 11px;
    line-height: 1.4;
}

.photo-reference-field {
    display: grid;
    gap: 5px;
}

.photo-reference-field label {
    font-size: 11px;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.photo-reference-field input[type="range"] {
    width: 100%;
}

.photo-reference-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.photo-reference-grid input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d7e0e9;
    border-radius: 10px;
    padding: 8px 9px;
    font-size: 12px;
    color: #24313f;
}

.photo-reference-empty {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
    padding: 12px;
    font-size: 12px;
    line-height: 1.45;
}

body.decision-modal-open {
  overflow: hidden;
}

body.decision-modal-open > *:not(.custom-modal-overlay) {
  pointer-events: none !important;
  user-select: none;
}

.custom-modal-overlay {
  pointer-events: auto;
}

.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 30000;
    pointer-events: none;
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-blocker {
    position: fixed;
    inset: 0;
    pointer-events: auto;
}

.tutorial-highlight {
    position: fixed;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    border-radius: 18px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.54);
    border: 2px solid rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.04);
    transition: top 0.24s ease, left 0.24s ease, width 0.24s ease, height 0.24s ease, border-radius 0.24s ease;
}

.tutorial-highlight::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 1px solid rgba(0, 140, 207, 0.48);
}

.tutorial-card {
    position: fixed;
    width: min(380px, calc(100vw - 32px));
    max-height: min(420px, calc(100vh - 32px));
    overflow: auto;
    border-radius: 18px;
    border: 1px solid rgba(189, 210, 226, 0.96);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
    padding: 18px 18px 16px;
    pointer-events: auto;
    transition: top 0.24s ease, left 0.24s ease;
}

.tutorial-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tutorial-card-kicker {
    color: #008ccf;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tutorial-card-title {
    color: #1f2937;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    margin: 5px 0 0;
}

.tutorial-card-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f4f7fa;
    color: #64748b;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.tutorial-card-close:hover {
    background: #e9f4fa;
    color: #008ccf;
}

.tutorial-card-body {
    color: #425466;
    font-size: 14px;
    line-height: 1.6;
}

.tutorial-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.tutorial-card-progress {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tutorial-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.tutorial-btn {
    min-width: 88px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid #cfe0ea;
    background: #ffffff;
    color: #233140;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    padding: 0 14px;
}

.tutorial-btn:hover {
    border-color: #008ccf;
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.08);
}

.tutorial-btn.primary {
    background: #eef7fb;
    color: #008ccf;
}

/* --- FOOTER / MATERIAL PANEL --- */
body.material-panel-peek {
    --footer-h: var(--footer-peek-h);
}

body.canvas-empty {
    --footer-h: 54px;
}

body.canvas-empty.material-panel-peek {
    --footer-h: 54px;
}

.app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--main-footer-h, 54px);
    background: #ffffff;
    color: #24313f;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 6px 18px;
    gap: 12px;
    z-index: 2600;
    overflow: hidden;
    border-top: 1px solid #e2e8f0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.08);
    transition: opacity 0.22s ease, transform 0.22s ease, padding 0.22s ease, border-color 0.22s ease, height 0.22s ease;
    box-sizing: border-box;
    will-change: transform, opacity, height;
}

body.material-panel-open .app-footer,
body.material-panel-peek .app-footer {
    height: var(--footer-h);
}

body.material-panel-fullscreen:not(.layout-tablet):not(.layout-mobile) .app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100vh - var(--header-h));
    box-sizing: border-box;
    border-radius: 0;
}

body.material-panel-peek:not(.layout-tablet):not(.layout-mobile) .app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--footer-peek-h);
    box-sizing: border-box;
}

.app-footer-top-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 24px;
}

.material-panel-toggle {
    border: 0;
    background: transparent;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    cursor: pointer;
    padding: 0;
    flex: 1;
    min-width: 0;
}

.material-summary-copy {
    display: grid;
    gap: 3px;
}

.material-summary-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.01em;
}

.material-summary-subtitle {
    font-size: 11px;
    color: #64748b;
}

.material-summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    flex: 1;
    max-width: 420px;
    min-width: 250px;
}

.material-summary-metric {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 8px;
    display: grid;
    gap: 1px;
    transition: all 0.2s ease;
}

.material-summary-metric:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.material-summary-metric.interactive-valuation-metric {
    cursor: pointer;
    border-color: #cbd5e1;
}

.material-summary-metric.interactive-valuation-metric:hover {
    background: #f0f9ff;
    border-color: #008ccf;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 140, 207, 0.1);
}

.material-summary-metric.interactive-valuation-metric .material-summary-metric-value {
    color: #008ccf;
    text-decoration: underline dotted #008ccf;
}

.material-summary-metric-label {
    font-size: 8.5px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.material-summary-metric-value {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.material-summary-progress-wrap {
    display: grid;
    gap: 6px;
    width: 120px;
    flex-shrink: 0;
}

#material-progress-bg {
    width: 100%;
    height: 12px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

#material-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #008ccf 0%, #00bcff 100%);
    transition: width 0.28s ease;
}

.material-summary-chevron {
    font-size: 11px;
    color: #64748b;
    transition: transform 0.28s ease;
    background: #f1f5f9;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
}

.material-panel-toggle:hover .material-summary-chevron {
    background: #e2e8f0;
    color: #0f172a;
}

.material-summary-toggle-side {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
}

.material-summary-hint {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}

body.material-panel-open .material-summary-chevron {
    transform: rotate(180deg);
}

.material-panel-details {
    display: none;
    grid-template-columns: 1fr;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

.bom-valuation-card {
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    padding: 20px;
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.bom-valuation-card table tbody tr {
    transition: background-color .16s ease;
}

.bom-valuation-card table tbody tr:hover {
    background: #eff8fd !important;
}

@media (max-width: 640px) {
    .bom-valuation-card { padding: 14px; border-radius: 12px; }
    .bom-valuation-card table { min-width: 620px; }
}

body.material-panel-open .material-panel-details {
    display: grid;
}

/* Keep the expanded BOM visually separated from the footer summary row. */
body.material-panel-open .material-panel-details,
body.material-panel-peek .material-panel-details {
    border-top: 1px solid #cbd5e1;
    padding-top: 12px;
}

.bom-table {
    text-align: left;
}

.bom-table .bom-row--item > td {
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.5;
    text-align: left !important;
    vertical-align: top;
}

.bom-table .bom-row--item > td:first-child,
.bom-table .bom-row--group > td:first-child,
.bom-table .bom-row--detail > td:first-child {
    text-align: center !important;
}

.bom-table .bom-row--item > td:last-child,
.bom-table .bom-row--group > td:last-child,
.bom-table .bom-row--detail > td:last-child {
    text-align: right !important;
    white-space: nowrap;
}

.bom-table .bom-row--group > td {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.5;
    text-align: left !important;
    vertical-align: top;
}

.bom-table .bom-row--detail > td {
    vertical-align: top;
}

.material-card {
    background: #ffffff;
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    padding: 12px 14px;
    display: grid;
    gap: 10px;
    box-shadow: 0 8px 18px rgba(25, 39, 52, 0.04);
}

.material-card-top {
    display: grid;
    grid-template-columns: minmax(240px, 0.85fr) minmax(640px, 1.6fr);
    gap: 12px;
    align-items: start;
}

.material-card-copy {
    min-width: 0;
}

.material-card-name {
    font-size: 14px;
    font-weight: 700;
}

.material-card-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #637487;
}

.material-card-breakdown {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 800;
    color: #213244;
    line-height: 1.3;
}

.material-card-inline-values {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.material-visual {
    display: grid;
    gap: 6px;
}

.material-visual-bar {
    display: flex;
    width: 100%;
    height: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: #d8e0e8;
}

.material-visual-piece { min-width: 2px; }
.material-piece-waste { background: #bfc9d4; }
.material-piece-segment { background: linear-gradient(90deg, #00bcff 0%, #54d3ff 100%); }
.material-piece-spare { background: #d5dce4; }

.material-visual-caption {
    font-size: 11px;
    color: #6a7a8b;
    text-align: right;
}

.material-card-value {
    background: #f7fafd;
    border: 1px solid #dce5ee;
    border-radius: 10px;
    padding: 7px 9px;
    display: grid;
    gap: 2px;
}

.material-card-value-compact.material-card-stock {
    background: #eef7fb;
    border-color: #b9dff0;
}

.material-card-value-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.material-card-value strong {
    font-size: 14px;
    font-weight: 700;
}

.material-optimizer {
    background: #ffffff;
    border: 1px solid #cfe2ef;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 8px 22px rgba(10, 73, 112, 0.06);
}

.material-optimizer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
}

.material-optimizer-head > div {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.material-optimizer-head strong {
    color: #172331;
    font-size: 14px;
}

.material-optimizer-head span {
    color: #617386;
    font-size: 12px;
}

.material-optimizer-pro-controls {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
}

.material-stock-toggle-group {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    white-space: nowrap;
}

.material-stock-toggle {
    min-width: 52px;
    height: 30px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid #b9dff0;
    background: #ffffff;
    color: #008ccf;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.material-stock-toggle.active {
    background: #eef7fb;
    border-color: #00a3d7;
    color: #007fb3;
    box-shadow: 0 0 0 2px rgba(0, 163, 215, 0.08);
}

.material-stock-toggle:hover {
    border-color: #73ccef;
}

.material-optimizer-btn {
    border: 1px solid #b9dff0;
    background: #eef7fb;
    color: #008ccf;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.material-optimizer-btn-pro {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    border-color: #99f6e4;
    color: #0f766e;
    min-width: 132px;
    width: auto;
    flex: 0 0 auto;
}
.material-optimizer-btn-pro:hover {
    background: #dffbf2;
    border-color: #5eead4;
    color: #0f766e;
}

.material-optimizer-results {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.material-optimizer-bar {
    display: flex;
    width: 100%;
    height: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: #d5dce4;
}

.material-optimizer-segment {
    min-width: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #001827;
    font-size: 12px;
    line-height: 1;
}

.material-optimizer-waste {
    min-width: 2px;
    background: #bfc9d4;
}

.material-optimizer-kerf {
    min-width: 2px;
    background: #172331;
    opacity: 0.78;
}

.material-optimizer-spare {
    min-width: 0;
    background: #d5dce4;
}

.material-optimizer-empty {
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    color: #64748b;
    background: #f8fafc;
    font-size: 12px;
}

.view-btns {
    display: flex;
    gap: 8px;
    background: #eee;
    padding: 4px;
    border-radius: 8px;
}

.view-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444; /* Kolor profilu w ikonce */
}

.view-btn svg {
    width: 100%;
    height: 100%;
}

.view-btn:hover {
    background: #f9f9f9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.view-btn.active {
    background: #008ccf;
    color: white; /* Profil staje się biały na aktywnym tle */
}

.view-btn.active svg path[stroke="red"] {
    stroke: #ffeb3b; /* Zmieniamy czerwony wymiar na żółty na aktywnym przycisku dla kontrastu */
}

.dim-selector-container {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    margin-bottom: 14px;
}

.dim-svg-btn {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 7px 5px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
}

.dim-svg-btn svg {
    width: 40px;
    height: 40px;
    display: block;
    margin: 0 auto;
}

.dim-svg-btn span {
    font-size: 11px;
    color: #666;
}

.dim-svg-btn.active {
    border-color: #00bcff;
    background: #eefbff;
}

.dim-svg-btn.active span {
    color: #008ccf;
    font-weight: bold;
}

/* Styl dla przycisku na kanwasie */
#add-segment-canvas {
    position: absolute;
    bottom: 20px; /* Umieszczamy na dole */
    right: 20px;  /* Po prawej stronie */
    z-index: 100; /* Nad Three.js */
    width: 60px;
    height: 60px;
    background-color: #008ccf; /* Kolor FlexPRO */
    color: white;
    border: none;
    border-radius: 50%; /* Okrągły */
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#add-segment-canvas:hover {
    background-color: #006fa5;
    transform: scale(1.1); /* Delikatne powiększenie */
}

.dim-switch {
    position: relative; width: 100px; height: 40px;
    background: #e0e0e0; border-radius: 20px;
    display: flex; align-items: center; cursor: pointer;
    overflow: hidden; border: 2px solid #ddd;
}
.dim-label {
    flex: 1; text-align: center; font-weight: bold; font-size: 14px; z-index: 1;
    transition: color 0.3s; color: #666;
}
.dim-selection-overlay {
    position: absolute; left: 0; top: 0; width: 50%; height: 100%;
    background: #008ccf; border-radius: 18px; transition: transform 0.3s ease;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: bold; z-index: 2;
}
/* Stan 3D (domyślny) - overlay na 3D */
.dim-switch.mode-3d .dim-selection-overlay { transform: translateX(100%); }
.dim-switch.mode-2d .dim-selection-overlay { transform: translateX(0%); }

@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

.canvas-help-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 18px;
}

.canvas-help-card {
    border: 1px solid #d7e0e9;
    border-radius: 16px;
    padding: 18px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfe 100%);
    display: grid;
    gap: 12px;
    justify-items: center;
    text-align: center;
}

.canvas-help-mouse {
    position: relative;
    width: 104px;
    height: 148px;
    display: grid;
    justify-items: center;
    align-content: start;
}

.canvas-help-mouse-body {
    position: relative;
    width: 72px;
    height: 108px;
    border-radius: 36px;
    border: 2px solid #3a4b5c;
    background: #fff;
    box-shadow: inset 0 -10px 24px rgba(0, 140, 207, 0.06);
}

.canvas-help-mouse-left,
.canvas-help-mouse-right {
    position: absolute;
    top: 14px;
    width: 28px;
    height: 28px;
    border-radius: 14px 14px 10px 10px;
    background: rgba(0, 140, 207, 0.08);
}

.canvas-help-mouse-left {
    left: 16px;
}

.canvas-help-mouse-right {
    right: 16px;
}

.canvas-help-mouse-wheel {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 20px;
    border-radius: 9px;
    background: #d7e0e9;
}

.canvas-help-mouse-variant-left .canvas-help-mouse-left,
.canvas-help-mouse-variant-right .canvas-help-mouse-right,
.canvas-help-mouse-variant-wheel .canvas-help-mouse-wheel {
    background: #008ccf;
}

.canvas-help-mouse-label {
    margin-top: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef7fb;
    color: #008ccf;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.canvas-help-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #233140;
}

.canvas-help-card-text {
    font-size: 13px;
    line-height: 1.5;
    color: #607284;
}

.dxf-import-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(620px, 1.7fr) minmax(330px, 0.92fr);
    gap: 18px;
    align-items: start;
    /* Leave room for the modal footer actions instead of clipping them. */
    height: min(680px, calc(100vh - 220px));
    overflow: hidden;
}

.dxf-import-summary-panel,
.dxf-import-preview-panel,
.dxf-import-controls-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.dxf-import-summary-panel,
.dxf-import-preview-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dxf-import-controls-panel {
    display: grid;
    gap: 10px;
    max-height: 100%;
    overflow: auto;
    padding-right: 4px;
}

.dxf-import-summary-panel {
    overflow: hidden;
}

.dxf-import-summary-panel .dxf-import-status {
    flex: 0 0 auto;
}

.dxf-import-summary-panel .dxf-import-issues {
    flex: 1 1 auto;
}

.dxf-import-controls-panel {
    align-content: start;
}

.dxf-project-modal {
    overflow: hidden;
}

.dxf-project-modal > div:last-child {
    overflow: hidden !important;
}

.dxf-import-status {
    padding: 12px 14px;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    color: #475569;
    background: #f8fbfd;
    line-height: 1.45;
    margin-bottom: 0;
}

.dxf-import-preview-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.dxf-import-preview-tab {
    border: 1px solid #d7e0e9;
    background: #ffffff;
    color: #475569;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.dxf-import-preview-tab.is-active {
    border-color: #008ccf;
    background: #eef7fb;
    color: #008ccf;
}

.dxf-import-preview-wrap {
    position: relative;
    flex: 1 1 auto;
    height: auto;
    min-height: 360px;
}

.dxf-import-preview-panel .dxf-import-info-box {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 8px 10px;
}

@media (min-width: 981px) {
    /* Desktop order: summary + controls | preview | diagnostics. */
    .dxf-import-layout {
        align-items: stretch;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .dxf-import-summary-panel {
        display: contents;
    }

    .dxf-import-summary-panel .dxf-import-status {
        grid-column: 1;
        grid-row: 1;
        align-self: start;
        width: 100%;
        box-sizing: border-box;
    }

    .dxf-import-summary-panel .dxf-import-issues {
        grid-column: 3;
        grid-row: 1 / span 2;
        height: 100%;
        overflow: auto;
        align-self: stretch;
    }

    .dxf-import-preview-panel {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .dxf-import-controls-panel {
        grid-column: 1;
        grid-row: 2;
        height: auto;
        max-height: none;
        overflow: visible;
        align-self: stretch;
        gap: 6px;
    }

    /* Keep every import option visible in the left column without a nested scrollbar. */
    .dxf-import-controls-panel .dxf-import-info-box {
        padding: 8px 10px;
        font-size: 11px;
    }

    .dxf-import-controls-panel .dxf-import-control-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 8px;
    }

    .dxf-import-controls-panel .dxf-import-field {
        font-size: 11px;
    }

    .dxf-import-controls-panel .dxf-import-field select {
        padding: 7px 9px;
        margin-top: 3px;
        border-radius: 9px;
        font-size: 12px;
    }

    .dxf-import-controls-panel .dxf-import-check-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .dxf-import-controls-panel .dxf-import-check-grid label,
    .dxf-import-controls-panel .dxf-import-limit-options label {
        padding: 7px 9px;
        font-size: 11px;
        border-radius: 9px;
    }

    .dxf-import-controls-panel .dxf-import-note {
        font-size: 11px;
        line-height: 1.3;
    }

    .dxf-import-controls-panel .dxf-import-limit-warning {
        padding: 9px;
        font-size: 11px;
        line-height: 1.3;
        border-radius: 9px;
    }

    .dxf-import-controls-panel .dxf-import-limit-options {
        gap: 6px;
    }
}

.dxf-import-preview-canvas {
    width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
    box-sizing: border-box;
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    background: #f8fbfd;
    display: block;
    cursor: grab;
    touch-action: none;
}

.dxf-import-preview-canvas.is-panning {
    cursor: grabbing;
}

/* --- RESPONSIVE APP SHELL --- */
.layout-tablet,
.layout-mobile {
    --header-h: 64px;
    --footer-h: 0px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.layout-tablet .header,
.layout-mobile .header {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    box-sizing: border-box;
    padding: 0 12px;
    gap: 10px;
    overflow: hidden;
}

.layout-tablet #content-wrapper,
.layout-mobile #content-wrapper {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow: hidden;
}

.layout-tablet .header-left img,
.layout-tablet .header-right > div:last-child img,
.layout-mobile .header-left img,
.layout-mobile .header-right > div:last-child img {
    height: 34px !important;
}

.layout-tablet .header-right,
.layout-mobile .header-right {
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 8px;
}

.layout-tablet .header-action-cluster,
.layout-mobile .header-action-cluster {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 7px;
    padding: 4px 0;
}

.layout-tablet .header-action-cluster::-webkit-scrollbar,
.layout-mobile .header-action-cluster::-webkit-scrollbar {
    display: none;
}

.layout-tablet .project-name-header-input,
.layout-mobile .project-name-header-input {
    width: 150px;
    flex: 0 0 150px;
}

.layout-tablet .project-lock-control,
.layout-tablet .profile-finish-control,
.layout-mobile .project-lock-control,
.layout-mobile .profile-finish-control {
    flex: 0 0 auto;
}

.layout-tablet .header-menu-dropdown,
.layout-mobile .header-menu-dropdown,
.layout-tablet .lang-dropdown,
.layout-mobile .lang-dropdown {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top) + 8px);
    right: 10px;
    left: auto;
    max-width: calc(100vw - 20px);
    max-height: min(70vh, 520px);
    overflow: auto;
    border-top: 0;
    z-index: 3600;
}

.layout-tablet .header-menu-dropdown,
.layout-mobile .header-menu-dropdown {
    min-width: min(340px, calc(100vw - 20px));
}

.layout-mobile .header-menu-dropdown {
    grid-template-columns: minmax(0, 1fr);
}

.layout-mobile .header-menu-section {
    grid-template-rows: 18px repeat(4, minmax(40px, auto));
}

.layout-tablet .lang-dropdown,
.layout-mobile .lang-dropdown {
    grid-template-columns: repeat(4, 42px);
    gap: 12px;
    padding: 12px;
}

.layout-tablet #main-sidebar,
.layout-mobile #main-sidebar {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top));
    left: 0;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom));
    width: min(390px, calc(100vw - 28px));
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    transform: translate3d(-110vw, 0, 0);
    opacity: 0.98;
    transition: transform 0.28s cubic-bezier(.22,.8,.24,1), box-shadow 0.28s ease;
    z-index: 3200;
    box-shadow: none;
    overscroll-behavior: contain;
}

.layout-tablet.mobile-main-open #main-sidebar,
.layout-mobile.mobile-main-open #main-sidebar {
    transform: translate3d(0, 0, 0);
    box-shadow: 14px 0 34px rgba(15, 23, 42, 0.14);
}

.layout-tablet #params-sidebar {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top));
    right: 0;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom));
    left: auto !important;
    width: min(420px, calc(100vw - 38px));
    min-width: 0;
    max-width: none;
    transform: translate3d(110vw, 0, 0);
    opacity: 0.98;
    border-left: 1px solid #d7e0e9;
    border-right: 0;
    border-top: 0;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    pointer-events: none;
    z-index: 3180;
    contain: layout paint;
}

.layout-tablet.mobile-params-open #params-sidebar.active {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
    box-shadow: -14px 0 34px rgba(15, 23, 42, 0.14);
}

.layout-mobile #params-sidebar {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top) + 6px);
    right: 8px;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 8px);
    left: 8px !important;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: none;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -16px 38px rgba(15, 23, 42, 0.16);
    transform: translateY(calc(100% + var(--mobile-action-h) + 20px));
    opacity: 1;
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: none;
    z-index: 3180;
    overscroll-behavior: contain;
    contain: layout paint;
}

.layout-mobile.mobile-params-open #params-sidebar.active {
    transform: translateY(0);
    pointer-events: auto;
}

.layout-mobile #tools-sidebar,
.layout-mobile #production-sidebar {
    position: fixed;
    top: calc(var(--header-h) + var(--safe-top) + 6px);
    right: 8px;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 8px);
    left: 8px !important;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: none;
    padding: 12px;
    box-sizing: border-box;
    border: 1px solid #d7e0e9;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -16px 38px rgba(15, 23, 42, 0.16);
    transform: translateY(calc(100% + var(--mobile-action-h) + 20px));
    opacity: 1;
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: none;
    z-index: 3180;
    overscroll-behavior: contain;
    contain: layout paint;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.layout-mobile.mobile-tools-open #tools-sidebar,
.layout-mobile.mobile-production-open #production-sidebar {
    transform: translateY(0);
    pointer-events: auto;
}

.layout-tablet #viewport-3d,
.layout-mobile #viewport-3d,
.layout-tablet #canvas-holder,
.layout-mobile #canvas-holder,
.layout-tablet #canvas-holder canvas,
.layout-mobile #canvas-holder canvas {
    flex: 1 1 100%;
    touch-action: none !important;
}

.layout-tablet .mobile-drawer-scrim,
.layout-mobile .mobile-drawer-scrim {
    display: block;
    position: fixed;
    inset: calc(var(--header-h) + var(--safe-top)) 0 calc(var(--mobile-action-h) + var(--safe-bottom)) 0;
    background: rgba(15, 23, 42, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3000;
}

.layout-tablet.mobile-main-open .mobile-drawer-scrim,
.layout-tablet.mobile-params-open .mobile-drawer-scrim,
.layout-mobile.mobile-main-open .mobile-drawer-scrim,
.layout-mobile.mobile-params-open .mobile-drawer-scrim {
    opacity: 1;
    pointer-events: auto;
}

.layout-tablet.mobile-drawer-modal-open .mobile-drawer-scrim,
.layout-mobile.mobile-drawer-modal-open .mobile-drawer-scrim {
    opacity: 1;
    pointer-events: none;
    z-index: 3000;
}

.layout-tablet.mobile-drawer-modal-open #main-sidebar,
.layout-mobile.mobile-drawer-modal-open #main-sidebar {
    transform: none !important;
    transition: none !important;
    pointer-events: none;
}

.layout-tablet.mobile-drawer-modal-open .drawer-modal.open,
.layout-mobile.mobile-drawer-modal-open .drawer-modal.open {
    z-index: 3900;
    pointer-events: auto;
}

.layout-tablet .drawer-modal,
.layout-mobile .drawer-modal {
    position: fixed;
    left: 10px;
    right: 10px;
    top: calc(var(--header-h) + var(--safe-top) + 8px);
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 8px);
    width: auto !important;
    min-width: 0;
    max-width: none !important;
    border-left: 1px solid #cfe1ef;
    border-radius: 16px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.2);
    z-index: 3450;
    overflow: hidden;
    contain: layout paint;
}

.layout-tablet .drawer-modal.open,
.layout-mobile .drawer-modal.open {
    display: flex;
    animation: none;
}

.layout-tablet .drawer-header,
.layout-mobile .drawer-header {
    flex: 0 0 auto;
    min-height: 54px;
    box-sizing: border-box;
    align-items: center;
    padding: 12px 14px;
    border-radius: 16px 16px 0 0;
}

.layout-tablet .close-drawer,
.layout-mobile .close-drawer {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: -8px -8px -8px 8px;
    border-radius: 12px;
    color: #008ccf;
    font-size: 28px;
}

.layout-tablet .drawer-content,
.layout-mobile .drawer-content {
    max-height: none;
    min-height: 0;
    flex: 1 1 auto;
    padding: 12px;
    overscroll-behavior: contain;
    overflow-y: auto;
    overflow-x: hidden;
}

.mobile-modal-stepper {
    display: none;
}

.layout-tablet .mobile-modal-stepper,
.layout-mobile .mobile-modal-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.layout-tablet .drawer-footer,
.layout-mobile .drawer-footer {
    flex-wrap: wrap;
    gap: 8px;
}

.layout-tablet .mobile-modal-stepper + .primary-btn,
.layout-mobile .mobile-modal-stepper + .primary-btn {
    min-width: 92px;
}

.layout-tablet .mobile-step-btn,
.layout-mobile .mobile-step-btn {
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.layout-tablet .mobile-step-next,
.layout-mobile .mobile-step-next {
    border-color: #008ccf;
    background: #008ccf;
    color: #ffffff;
}

.layout-tablet .mobile-step-label,
.layout-mobile .mobile-step-label {
    flex: 1;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.layout-tablet #accessories-gallery,
.layout-tablet #power-gallery,
.layout-tablet #options-gallery,
.layout-mobile #accessories-gallery,
.layout-mobile #power-gallery,
.layout-mobile #options-gallery {
    display: block !important;
    width: 100% !important;
    max-width: 100%;
    padding: 10px !important;
    overflow-x: hidden !important;
}

.layout-tablet #options-gallery,
.layout-mobile #options-gallery {
    overflow-y: auto !important;
}

.layout-tablet #accessories-gallery > *,
.layout-tablet #power-gallery > *,
.layout-tablet #options-gallery > *,
.layout-mobile #accessories-gallery > *,
.layout-mobile #power-gallery > *,
.layout-mobile #options-gallery > * {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.layout-tablet .profile-gallery-grid,
.layout-tablet .orientations-gallery-grid,
.layout-tablet .bend-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.layout-mobile .profile-gallery-grid,
.layout-mobile .orientations-gallery-grid,
.layout-mobile .bend-gallery-grid,
.layout-mobile #orientation-modal.has-flip-option .orientations-gallery-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.layout-tablet .profile-card,
.layout-mobile .profile-card {
    min-height: 132px;
    border-radius: 12px;
    overflow: visible;
}

.layout-mobile .profile-card {
    position: relative;
    grid-template-columns: minmax(0, 1fr) 92px;
    grid-template-areas:
        "brand visual"
        "title visual"
        "subtitle visual";
    align-items: center;
    align-content: center;
    text-align: left;
    min-height: 92px;
    gap: 3px 10px;
    padding: 10px 44px 10px 12px;
}

.layout-mobile .profile-card .drawer-card-visual {
    grid-area: visual;
}

.layout-mobile .profile-card .drawer-card-brand {
    grid-area: brand;
    justify-self: start;
    min-height: 18px;
}

.layout-mobile .profile-card .drawer-card-title {
    grid-area: title;
    min-width: 0;
    width: 100%;
}

.layout-mobile .profile-card .drawer-card-subtitle {
    grid-area: subtitle;
    min-width: 0;
    width: 100%;
}

.layout-mobile .drawer-card-brand img {
    max-width: 76px;
    max-height: 20px;
}

.layout-mobile .drawer-card-visual {
    min-height: 72px;
    height: 72px;
    padding: 6px;
    display: grid;
    place-items: center;
    border-radius: 10px;
}

.layout-mobile .drawer-card-visual img {
    max-width: 86px !important;
    max-height: 64px;
    object-fit: contain;
}

.layout-mobile .orientation-flip-visual svg {
    width: 78px;
    max-height: 62px;
}

.layout-mobile .drawer-card-title {
    font-size: 13px;
    line-height: 1.2;
    padding-right: 0;
}

.layout-mobile .drawer-card-subtitle {
    font-size: 11px;
    line-height: 1.35;
    color: #64748b;
}

.layout-mobile .drawer-card-meta {
    display: none;
    gap: 8px;
    text-align: left;
}

.layout-mobile .drawer-mobile-info .drawer-card-meta {
    display: grid;
}

.layout-mobile .drawer-card-info-btn {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 26px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #bdeafa;
    border-radius: 999px;
    background: #f7fdff;
    color: #008ccf;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.layout-mobile .drawer-card-info-btn:active {
    transform: scale(0.94);
}

.layout-mobile .drawer-card-meta .drawer-meta-line-list,
.layout-mobile .drawer-card-meta .drawer-chip-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
}

.layout-mobile .drawer-meta-line,
.layout-mobile .drawer-chip {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.layout-mobile .drawer-meta-label {
    display: block;
    margin-bottom: 4px;
    white-space: normal;
}

.layout-mobile .drawer-meta-line strong,
.layout-mobile .drawer-chip {
    white-space: normal;
    overflow-wrap: anywhere;
}

.layout-mobile .drawer-header {
    min-height: 44px;
    padding: 8px 12px;
}

.layout-mobile .close-drawer {
    width: 36px;
    height: 36px;
    font-size: 24px;
}

.layout-mobile .drawer-content {
    padding: 8px;
}

.layout-mobile .profile-gallery-grid,
.layout-mobile .orientations-gallery-grid,
.layout-mobile .bend-gallery-grid,
.layout-mobile #orientation-modal.has-flip-option .orientations-gallery-grid {
    gap: 8px;
}

.layout-mobile .profile-card {
    min-height: 74px;
    gap: 2px 8px;
    padding: 8px 38px 8px 10px;
}

.layout-mobile .drawer-card-visual {
    min-height: 58px;
    height: 58px;
    padding: 4px;
}

.layout-mobile .drawer-card-visual img {
    max-width: 78px !important;
    max-height: 54px;
}

.layout-mobile .drawer-card-title {
    font-size: 12px;
}

.layout-mobile .drawer-card-subtitle {
    font-size: 10px;
}

.layout-mobile .drawer-card-info-btn {
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    font-size: 12px;
}

.layout-tablet .segments-list,
.layout-mobile .segments-list,
.layout-tablet .material-panel-details,
.layout-mobile .material-panel-details {
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}

.layout-tablet .segment-item,
.layout-mobile .segment-item {
    min-height: 52px;
    padding: 12px;
    border-radius: 10px;
}

.layout-tablet .segment-action-row,
.layout-mobile .segment-action-row {
    gap: 8px;
}

.layout-tablet .add-seg-btn,
.layout-tablet .duplicate-seg-btn,
.layout-tablet .template-seg-btn,
.layout-mobile .add-seg-btn,
.layout-mobile .duplicate-seg-btn,
.layout-mobile .template-seg-btn {
    min-height: 42px;
    border-radius: 10px;
}

.layout-tablet .segments-onboarding-item,
.layout-mobile .segments-onboarding-item {
    border-radius: 12px;
    min-height: 54px;
}

.layout-tablet .mobile-action-bar,
.layout-mobile .mobile-action-bar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 8px;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(8px + var(--safe-bottom));
    width: calc(100vw - 20px);
    height: 56px;
    padding: 6px;
    box-sizing: border-box;
    border: 1px solid rgba(207, 225, 239, 0.95);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14);
    z-index: 3300;
    backdrop-filter: blur(10px);
}

.presentation-mode .mobile-action-bar,
.project-modal-open .mobile-action-bar {
    opacity: 0;
    pointer-events: none;
}

.layout-tablet.project-modal-open .project-modal-overlay,
.layout-mobile.project-modal-open .project-modal-overlay {
    padding: 10px !important;
    align-items: stretch !important;
    justify-content: center !important;
}

.layout-tablet .project-modal-shell,
.layout-mobile .project-modal-shell {
    width: calc(100vw - 20px) !important;
    max-height: calc(100vh - 20px) !important;
    padding: 16px !important;
    border-radius: 16px !important;
}

.layout-tablet .project-modal-head,
.layout-mobile .project-modal-head {
    align-items: flex-start !important;
}

.layout-tablet .project-modal-body,
.layout-mobile .project-modal-body {
    margin-top: 12px !important;
    padding-right: 0 !important;
    overscroll-behavior: contain;
}

.layout-mobile .shape-template-grid,
.layout-mobile .dxf-import-workspace,
.layout-mobile .compatibility-modal-layout {
    grid-template-columns: minmax(0, 1fr) !important;
}

.layout-mobile .shape-template-preview {
    height: 160px;
}

.mobile-action-btn {
    display: inline-grid;
    grid-template-columns: 22px minmax(0, auto);
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #415469;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.mobile-action-btn:disabled,
.mobile-action-btn.is-disabled {
    opacity: 0.38;
    pointer-events: none;
    filter: grayscale(0.3);
}

.mobile-action-btn svg {
    width: 22px;
    height: 22px;
}

.mobile-main-open .mobile-action-btn[data-mobile-action="main"],
.mobile-params-open .mobile-action-btn[data-mobile-action="params"],
.mobile-tools-open .mobile-action-btn[data-mobile-action="tools"],
.mobile-production-open .mobile-action-btn[data-mobile-action="production"] {
    background: #eaf7ff;
    color: var(--accent-color);
}

.layout-tablet .app-footer,
.layout-mobile .app-footer {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 8px);
    max-height: min(48vh, 460px);
    height: min(48vh, 460px);
    border: 1px solid #d7e0e9;
    border-radius: 16px;
    box-sizing: border-box;
    transform: translateY(calc(100% + var(--mobile-action-h) + 24px));
    opacity: 0;
    pointer-events: none;
    z-index: 3160;
    overflow: auto;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    transition: transform 0.28s cubic-bezier(.22,.8,.24,1), opacity 0.28s ease;
}

.layout-tablet.material-panel-fullscreen .app-footer,
.layout-mobile.material-panel-fullscreen .app-footer {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.layout-tablet .app-footer-top-row,
.layout-mobile .app-footer-top-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.layout-tablet .material-panel-toggle,
.layout-mobile .material-panel-toggle {
    width: 100%;
}

.layout-tablet .quote-checklist,
.layout-mobile .quote-checklist {
    width: 100%;
    padding-left: 0 !important;
    border-left: 0 !important;
    margin-top: 2px;
}

.layout-tablet .checklist-steps,
.layout-mobile .checklist-steps {
    flex-wrap: wrap;
    gap: 6px 12px;
    overflow-x: visible;
}

body.presentation-mode .app-footer {
    transform: translateY(calc(100% + var(--mobile-action-h) + 24px)) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.layout-tablet.material-panel-fullscreen,
.layout-mobile.material-panel-fullscreen {
    grid-template-rows: var(--header-h) minmax(0, 1fr) 0;
}

.layout-tablet .material-panel-toggle,
.layout-mobile .material-panel-toggle {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 48px;
}

.layout-tablet.material-panel-fullscreen .material-panel-toggle,
.layout-mobile.material-panel-fullscreen .material-panel-toggle {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.layout-tablet.material-panel-fullscreen .material-summary-metrics,
.layout-mobile.material-panel-fullscreen .material-summary-metrics {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

/* On compact layouts the summary and the order details are separate layers.
   The details button must not collapse the whole summary panel. */
.layout-tablet.material-panel-fullscreen .material-panel-details,
.layout-mobile.material-panel-fullscreen .material-panel-details {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.layout-tablet.material-panel-fullscreen.material-panel-details-open .material-panel-details,
.layout-mobile.material-panel-fullscreen.material-panel-details-open .material-panel-details {
    display: grid;
}

.layout-tablet .material-summary-metrics,
.layout-tablet .material-summary-progress-wrap,
.layout-tablet .material-summary-hint,
.layout-mobile .material-summary-metrics,
.layout-mobile .material-summary-progress-wrap,
.layout-mobile .material-summary-hint {
    display: none;
}

.layout-tablet #canvas-tools,
.layout-mobile #canvas-tools {
    display: none !important;
}

.layout-tablet.canvas-empty #canvas-tools,
.layout-mobile.canvas-empty #canvas-tools {
    display: none;
}

.layout-tablet #canvas-help-btn,
.layout-mobile #canvas-help-btn,
.layout-tablet #canvas-photo-ref-shortcut-btn,
.layout-mobile #canvas-photo-ref-shortcut-btn {
    display: none !important;
}

.layout-tablet .canvas-view-mode-btn,
.layout-tablet .canvas-tool-drawer-trigger,
.layout-tablet .canvas-tool-btn,
.layout-mobile .canvas-view-mode-btn,
.layout-mobile .canvas-tool-drawer-trigger,
.layout-mobile .canvas-tool-btn {
    min-height: 42px;
    height: 42px;
}

.layout-tablet .canvas-tool-drawer-trigger,
.layout-tablet .canvas-tool-btn,
.layout-mobile .canvas-tool-drawer-trigger,
.layout-mobile .canvas-tool-btn {
    min-width: 42px;
    width: 42px;
}

.layout-tablet #viewport-3d.canvas-tools-armed #canvas-tools .canvas-tool-drawer.geometry-gated-tool,
.layout-mobile #viewport-3d.canvas-tools-armed #canvas-tools .canvas-tool-drawer.geometry-gated-tool {
    width: 42px;
}

.layout-tablet .canvas-tool-drawer.is-open .canvas-tool-btn,
.layout-mobile .canvas-tool-drawer.is-open .canvas-tool-btn {
    width: min(222px, calc(100vw - 32px));
}

.layout-tablet .canvas-tool-drawer-list,
.layout-mobile .canvas-tool-drawer-list {
    gap: 5px;
    max-height: calc(100vh - var(--header-h) - var(--mobile-action-h) - var(--safe-top) - var(--safe-bottom) - 148px);
    overflow-y: auto;
    overflow-x: visible;
    overscroll-behavior: contain;
    padding: 0 2px 2px 0;
    scrollbar-width: thin;
}

.layout-tablet .local-dimension-controls,
.layout-tablet .shape-rotation-controls,
.layout-tablet .suspension-controls,
.layout-mobile .local-dimension-controls,
.layout-mobile .shape-rotation-controls,
.layout-mobile .suspension-controls {
    left: 10px;
    right: 70px;
    top: auto;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 12px);
    max-width: none;
}

.layout-tablet .shape-rotation-controls,
.layout-tablet .suspension-controls,
.layout-mobile .shape-rotation-controls,
.layout-mobile .suspension-controls {
    flex-wrap: wrap;
    align-items: center;
}

.layout-tablet .shape-rotation-axis,
.layout-mobile .shape-rotation-axis {
    grid-template-columns: 22px 34px minmax(92px, 1fr) 38px 34px;
    flex: 1 1 260px;
}

.layout-tablet .shape-rotation-controls button,
.layout-tablet .local-dimension-controls button,
.layout-tablet .suspension-controls button,
.layout-mobile .shape-rotation-controls button,
.layout-mobile .local-dimension-controls button,
.layout-mobile .suspension-controls button {
    min-height: 36px;
}

.layout-tablet {
    --header-h: 72px;
    --mobile-action-h: 74px;
}

.layout-tablet .header {
    padding: 0 18px;
}

.layout-tablet .header-left img {
    height: 42px !important;
}

.layout-tablet .project-name-header-input {
    width: 190px;
    flex-basis: 190px;
}

.layout-tablet #main-sidebar {
    width: min(430px, calc(100vw - 96px));
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 12px);
    left: 12px;
    top: calc(var(--header-h) + var(--safe-top) + 12px);
    border: 1px solid #d7e0e9;
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
    background: rgba(235, 241, 247, 0.98);
    transform: translate3d(calc(-100% - 28px), 0, 0);
}

.layout-tablet.mobile-main-open #main-sidebar {
    transform: translate3d(0, 0, 0);
}

.layout-tablet #params-sidebar {
    width: min(460px, calc(100vw - 108px));
    top: calc(var(--header-h) + var(--safe-top) + 12px);
    right: 12px;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 12px);
    border: 1px solid #d7e0e9;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
    transform: translate3d(calc(100% + 28px), 0, 0);
}

.layout-tablet.mobile-params-open #params-sidebar.active {
    transform: translate3d(0, 0, 0);
}

.layout-tablet .mobile-action-bar {
    left: 50%;
    right: auto;
    width: min(520px, calc(100vw - 32px));
    height: 60px;
    transform: translateX(-50%);
    bottom: calc(12px + var(--safe-bottom));
    border-radius: 18px;
}

.layout-tablet .mobile-action-btn {
    grid-template-columns: 24px minmax(0, auto);
    font-size: 12px;
}

.layout-tablet .drawer-modal {
    left: 34px;
    right: 34px;
    top: calc(var(--header-h) + var(--safe-top) + 16px);
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 16px);
}

.layout-tablet .profile-gallery-grid,
.layout-tablet .orientations-gallery-grid,
.layout-tablet .bend-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    align-content: start;
    align-items: start;
}

.layout-tablet .profile-card {
    min-height: 148px;
    position: relative;
    grid-template-columns: minmax(0, 1fr) 116px;
    grid-template-areas:
        "brand visual"
        "title visual"
        "subtitle visual";
    align-items: center;
    align-content: center;
    text-align: left;
    gap: 4px 12px;
    padding: 12px 44px 12px 14px;
}

.layout-tablet .drawer-card-visual {
    grid-area: visual;
    min-height: 90px;
    height: 90px;
    padding: 8px;
}

.layout-tablet .drawer-card-visual img {
    max-width: 108px !important;
    max-height: 82px;
    object-fit: contain;
}

.layout-tablet .drawer-card-brand {
    grid-area: brand;
    justify-content: flex-start;
    min-height: 20px;
}

.layout-tablet .drawer-card-title {
    grid-area: title;
    min-width: 0;
    font-size: 15px;
}

.layout-tablet .drawer-card-subtitle {
    grid-area: subtitle;
    min-width: 0;
    font-size: 11px;
}

.layout-tablet .drawer-card-meta {
    display: none;
}

.layout-tablet .drawer-mobile-info .drawer-card-meta {
    display: grid;
}

.layout-tablet .drawer-card-info-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #bdeafa;
    border-radius: 999px;
    background: #f7fdff;
    color: #008ccf;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.layout-tablet #canvas-tools {
    top: 14px;
    right: 14px;
}

.layout-tablet .canvas-view-mode-btn,
.layout-tablet .canvas-tool-drawer-trigger,
.layout-tablet .canvas-tool-btn {
    min-height: 46px;
    height: 46px;
}

.layout-tablet .canvas-tool-drawer-trigger,
.layout-tablet .canvas-tool-btn {
    min-width: 46px;
    width: 46px;
}

.layout-tablet #viewport-3d.canvas-tools-armed #canvas-tools .canvas-tool-drawer.geometry-gated-tool {
    width: 46px;
}

.layout-tablet .canvas-tool-drawer.is-open .canvas-tool-btn {
    width: min(248px, calc(100vw - 42px));
}

.layout-tablet .canvas-tool-drawer-list {
    max-height: calc(100vh - var(--header-h) - var(--mobile-action-h) - var(--safe-top) - var(--safe-bottom) - 120px);
}

.layout-tablet .local-dimension-controls {
    left: 18px;
    right: 86px;
    bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 18px);
}

@media (max-width: 599px) {
    .layout-mobile {
        --header-h: 58px;
        --mobile-action-h: 72px;
    }

    .layout-mobile .header-left img {
        width: 112px !important;
        max-width: 112px;
        height: auto !important;
        object-fit: contain;
    }

    .layout-mobile .header {
        min-width: 0;
        overflow: hidden;
        position: fixed;
        top: var(--safe-top);
        left: 0;
        right: 0;
        height: var(--header-h);
        z-index: 4200;
        background: #ffffff;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.14);
    }

    .layout-mobile .header-left {
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        min-width: 0;
        margin-right: 12px;
    }

    .layout-mobile .header-right {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        overflow: visible !important;
        padding-right: 12px;
        box-sizing: border-box;
    }

    .layout-mobile .header-right > div:last-child {
        display: none;
    }

    .layout-mobile .header-action-cluster {
        flex: 1 1 auto;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        overflow: visible !important;
        gap: 8px;
    }

    .layout-mobile .project-name-header-input {
        display: none;
    }

    .layout-mobile .project-lock-status,
    .layout-mobile .profile-ral-palette-btn,
    .layout-mobile .material-summary-subtitle {
        display: none;
    }

    .layout-mobile .project-lock-control {
        display: inline-flex !important;
        position: static !important;
        height: auto;
        z-index: auto;
        background: transparent;
        border: 0;
        margin: 0;
    }



    .layout-mobile .profile-finish-control {
        display: none;
    }

    .layout-mobile .mobile-profile-finish-panel {
        display: grid;
        gap: 6px;
        margin-top: 10px;
    }

    .layout-mobile .mobile-profile-ral-palette-btn {
        display: inline-flex;
    }

    .layout-mobile #reset-project-btn,
    .layout-mobile #presentation-mode-btn,
    .layout-mobile #tutorial-launch-btn {
        display: none;
    }



    .layout-mobile.mobile-params-open #canvas-tools {
        display: none !important;
    }

    .layout-mobile .history-controls {
        display: inline-flex !important;
        position: static !important;
        z-index: auto;
        gap: 4px;
        margin: 0;
    }

    .layout-mobile .history-controls .header-icon-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .layout-mobile .mobile-more-menu {
        display: inline-flex !important;
        position: static !important;
        z-index: auto;
        flex: 0 0 auto;
        margin: 0;
    }

    .layout-mobile .mobile-more-menu .header-menu-dropdown {
        display: none;
        grid-template-columns: minmax(0, 1fr);
        left: 10px;
        right: 10px;
        top: calc(var(--header-h) + var(--safe-top) + 8px);
        width: auto;
        min-width: 0;
        gap: 10px;
    }

    .layout-mobile #canvas-tools {
        top: 10px;
        right: 10px;
        z-index: 3350;
    }

    .layout-mobile .mobile-more-menu.open .header-menu-dropdown {
        display: grid;
    }

    .layout-mobile .mobile-more-actions {
        grid-template-rows: 18px repeat(6, minmax(40px, auto));
    }

    .layout-mobile .mobile-more-languages {
        grid-template-rows: auto minmax(0, auto);
    }

    .layout-mobile .mobile-more-language-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 10px;
        padding: 4px 0;
    }

    .layout-mobile .mobile-lang-option {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        height: 38px !important;
        padding: 0 !important;
        box-sizing: border-box;
        border: 1px solid #d7e3ee;
        border-radius: 50%;
        background: #fff;
        color: #243648;
        cursor: pointer;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
        place-self: center;
    }

    .layout-mobile .header-right .mobile-lang-option img,
    .layout-mobile .header-right .mobile-lang-option .lang-text-badge {
        width: 32px !important;
        height: 32px !important;
        border: 0;
        border-radius: 50% !important;
        object-fit: cover !important;
        font-size: 10px;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .layout-mobile .mobile-lang-option.active {
        border-color: var(--accent-color);
        box-shadow: 0 0 0 3px rgba(0, 188, 255, 0.18);
        background: #eaf8ff;
    }

    .layout-mobile .lang-switcher,
    .layout-mobile .lang-dropdown {
        display: none !important;
        visibility: hidden !important;
    }

    .layout-mobile .profile-finish-control select {
        max-width: 108px;
    }

    .layout-mobile .profile-custom-ral-input {
        width: 68px;
    }

    .layout-mobile #main-sidebar {
        width: min(360px, calc(100vw - 18px));
        bottom: calc(var(--mobile-action-h) + var(--safe-bottom));
        padding: 12px;
    }

    .layout-mobile .primary-selection-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .layout-mobile .profile-section-preview {
        grid-template-columns: 84px minmax(0, 1fr);
        grid-template-rows: auto auto;
        justify-items: start;
    }

    .layout-mobile .sidebar-profile-visual {
        grid-row: 1 / span 2;
        width: 84px;
        height: 56px;
    }

    .layout-mobile .sidebar-profile-visual img {
        max-width: 82px;
        max-height: 54px;
    }

    .layout-mobile .segment-action-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .layout-mobile .segments-onboarding-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
    }

    .layout-mobile .segments-onboarding-status {
        width: 100%;
        justify-content: center;
    }

    .layout-mobile .material-card,
    .layout-mobile .material-card-top,
    .layout-mobile .material-card-inline-values {
        grid-template-columns: minmax(0, 1fr);
    }

    .layout-mobile .material-card-inline-values {
        gap: 6px;
    }

    .layout-mobile .mobile-action-btn {
        grid-template-columns: 1fr;
        gap: 2px;
        font-size: 10px;
    }

    .layout-mobile .mobile-action-bar {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: min(370px, calc(100vw - 20px)) !important;
    }

    .layout-mobile .mobile-action-btn svg {
        justify-self: center;
    }

    .layout-mobile #params-container {
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
    }

    .layout-mobile .segment-params-panel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding-bottom: 4px;
        min-width: 0;
        overflow-x: hidden;
    }

    .layout-mobile .segment-params-title,
    .layout-mobile .segment-params-top,
    .layout-mobile .segment-control-angle,
    .layout-mobile .segment-control-arc_len,
    .layout-mobile .segment-params-actions {
        grid-column: 1 / -1;
    }

    .layout-mobile .segment-params-top {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(126px, 0.72fr);
        gap: 6px;
        align-items: end;
        min-width: 0;
        max-width: 100%;
    }

    .layout-mobile .segment-bend-control {
        min-width: 0;
    }

    .layout-mobile .segment-bend-btn {
        min-height: 38px;
        margin-top: 3px;
        padding: 0 8px;
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .layout-mobile .dim-selector-container {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .layout-mobile .dim-svg-btn {
        width: auto;
        min-width: 0;
        min-height: 38px;
        padding: 3px 2px;
        gap: 1px;
    }

    .layout-mobile .dim-svg-btn svg {
        width: 22px;
        height: 22px;
    }

    .layout-mobile .dim-svg-btn span {
        font-size: 9px;
        line-height: 1;
    }

    .layout-mobile .segment-control-group {
        margin-bottom: 7px;
        min-width: 0;
        max-width: 100%;
    }

    .layout-mobile .segment-control-head {
        margin-bottom: 2px;
        align-items: center;
        min-height: 42px;
    }

    .layout-mobile .segment-control-copy label {
        font-size: 11px;
    }

    .layout-mobile .segment-control-input {
        width: 58px;
        height: 30px;
        padding: 3px 6px;
        font-size: 12px;
    }

    .layout-mobile .segment-control-slider {
        height: 10px;
        margin: 5px 0 0;
    }

    .layout-mobile .angle-btns {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 3px;
        margin-top: 3px;
    }

    .layout-mobile .angle-btns .system-btn {
        min-height: 28px;
        padding: 0;
        font-size: 10px;
    }

    .layout-mobile .segment-params-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 0;
    }

    .layout-mobile .segment-params-actions .system-btn {
        min-height: 34px;
        padding: 0 8px;
        font-size: 11px;
        white-space: normal;
    }

    .layout-mobile .canvas-tool-drawer.is-open .canvas-tool-btn::after {
        max-width: 150px;
        font-size: 11px;
        line-height: 1.15;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .layout-mobile .local-dimension-controls,
    .layout-mobile .shape-rotation-controls,
    .layout-mobile .suspension-controls {
        right: 10px;
        bottom: calc(var(--mobile-action-h) + var(--safe-bottom) + 8px);
    }
}

.layout-tablet .shape-rotation-controls,
.layout-tablet .suspension-controls,
.layout-mobile .shape-rotation-controls,
.layout-mobile .suspension-controls {
    left: 50%;
    right: auto;
    top: 10px;
    bottom: auto;
    max-width: calc(100vw - 24px);
    transform: translate(-50%, -12px);
}

.layout-tablet .shape-rotation-controls.active,
.layout-tablet .suspension-controls.active,
.layout-mobile .shape-rotation-controls.active,
.layout-mobile .suspension-controls.active {
    transform: translateX(-50%);
}

@media (min-width: 900px) {
    body:not(.layout-tablet):not(.layout-mobile) .mobile-drawer-scrim,
    body:not(.layout-tablet):not(.layout-mobile) .mobile-action-bar {
        display: none;
    }
}

.dxf-import-preview-hint {
    position: absolute;
    left: 12px;
    bottom: 10px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(215, 224, 233, 0.85);
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
}

.dxf-import-issues {
    display: grid;
    gap: 8px;
    margin: 0;
    max-height: none;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.dxf-import-issue-empty {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
}

.dxf-import-issue-card {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 10px;
    text-align: left;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #78350f;
    border-radius: 12px;
    padding: 8px 10px;
    cursor: pointer;
}

.dxf-import-issue-card.is-danger {
    border-color: #fecaca;
    background: #fff7f7;
    color: #991b1b;
}

.dxf-import-issue-card.is-active {
    outline: 2px solid #008ccf;
    outline-offset: 1px;
}

.dxf-import-issue-index {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f59e0b;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.dxf-import-issue-card.is-danger .dxf-import-issue-index {
    background: #ef4444;
}

.dxf-import-issue-card strong {
    display: block;
    font-size: 12px;
    margin-bottom: 2px;
}

.dxf-import-issue-card small {
    display: block;
    color: #475569;
    font-size: 12px;
    line-height: 1.35;
}

.dxf-import-issue-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 7px;
}

.dxf-import-issue-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f59e0b;
    background: #ffffff;
    color: #92400e;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 800;
}

.dxf-import-issue-action.primary {
    border-color: #008ccf;
    color: #006fa5;
    background: #eef7fb;
}

.dxf-import-issue-action:hover {
    background: #fffbeb;
}

.dxf-import-info-box {
    padding: 10px 12px;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    line-height: 1.45;
}

.dxf-import-info-box.strong {
    color: #334155;
}

.dxf-import-control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.dxf-import-field {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.dxf-import-field select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    padding: 9px 11px;
    margin-top: 5px;
    background: #fff;
}

.dxf-import-check-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.dxf-import-check-grid label,
.dxf-import-limit-options label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #475569;
    font-size: 13px;
    line-height: 1.35;
    padding: 9px 11px;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    background: #fff;
}

.dxf-import-note {
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
}

.dxf-import-limit-group {
    padding: 10px;
    border: 1px solid #fbbf24;
    border-radius: 12px;
    background: #fffbeb;
}

.dxf-import-limit-warning {
    padding: 12px;
    border: 1px solid #fbbf24;
    background: #fffbeb;
    color: #92400e;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.45;
}

.dxf-import-limit-options {
    gap: 8px;
    margin-top: 8px;
}

.dxf-import-limit-group .dxf-import-limit-warning {
    border: 0;
    padding: 0;
    background: transparent;
}

.dxf-import-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 980px) {
    .dxf-import-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .dxf-import-summary-panel,
    .dxf-import-controls-panel {
        max-height: none;
        overflow: visible;
    }

    .dxf-import-summary-panel {
        display: flex;
    }
}

/* Step-by-Step Wizard for Photo Reference Panel */
.photo-ref-wizard-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 16px 0;
    padding: 0;
    position: relative;
}

.photo-ref-wizard-steps::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 15px;
    right: 15px;
    height: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.photo-ref-wizard-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    flex: 1;
}

.photo-ref-wizard-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.photo-ref-wizard-step-item.active .photo-ref-wizard-step {
    border-color: #008ccf;
    background: #008ccf;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 140, 207, 0.15);
}

.photo-ref-wizard-step-item.completed .photo-ref-wizard-step {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

.photo-ref-step-label {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: color 0.25s ease;
}

.photo-ref-wizard-step-item.active .photo-ref-step-label {
    color: #008ccf;
}

.photo-ref-wizard-step-item.completed .photo-ref-step-label {
    color: #10b981;
}

.photo-ref-step-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dxf-import-issue-action.primary {
    border-color: #008ccf;
    color: #006fa5;
    background: #eef7fb;
}

.dxf-import-issue-action:hover {
    background: #fffbeb;
}

.dxf-import-info-box {
    padding: 10px 12px;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    line-height: 1.45;
}

.dxf-import-info-box.strong {
    color: #334155;
}

.dxf-import-control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.dxf-import-field {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.dxf-import-field select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    padding: 9px 11px;
    margin-top: 5px;
    background: #fff;
}

.dxf-import-check-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.dxf-import-check-grid label,
.dxf-import-limit-options label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #475569;
    font-size: 13px;
    line-height: 1.35;
    padding: 9px 11px;
    border: 1px solid #d7e0e9;
    border-radius: 12px;
    background: #fff;
}

.dxf-import-note {
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
}

.dxf-import-limit-warning {
    padding: 12px;
    border: 1px solid #fbbf24;
    background: #fffbeb;
    color: #92400e;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.45;
}

.dxf-import-limit-options {
    gap: 8px;
}

.dxf-import-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 980px) {
    .dxf-import-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .dxf-import-summary-panel,
    .dxf-import-controls-panel {
        max-height: none;
        overflow: visible;
    }
}

/* Step-by-Step Wizard for Photo Reference Panel */
.photo-ref-wizard-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 16px 0;
    padding: 0;
    position: relative;
}

.photo-ref-wizard-steps::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 15px;
    right: 15px;
    height: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.photo-ref-wizard-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    flex: 1;
}

.photo-ref-wizard-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.photo-ref-wizard-step-item.active .photo-ref-wizard-step {
    border-color: #008ccf;
    background: #008ccf;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 140, 207, 0.15);
}

.photo-ref-wizard-step-item.completed .photo-ref-wizard-step {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

.photo-ref-step-label {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: color 0.25s ease;
}

.photo-ref-wizard-step-item.active .photo-ref-step-label {
    color: #008ccf;
}

.photo-ref-wizard-step-item.completed .photo-ref-step-label {
    color: #10b981;
}

.photo-ref-step-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.photo-ref-wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    gap: 8px;
}

/* --- CHECKLIST W DOLNYM PASKU --- */
.quote-checklist {
    display: flex;
    align-items: center;
    gap: 16px;
    box-sizing: border-box;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

body:not(.layout-tablet):not(.layout-mobile) .quote-checklist {
    min-height: 44px;
    min-width: 0;
    margin-left: auto;
    justify-content: flex-end;
}

body:not(.layout-tablet):not(.layout-mobile) .quote-checklist:not(.sidebar-checklist-steps):not(.is-expanded) {
    display: none !important;
}

.checklist-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

body:not(.layout-tablet):not(.layout-mobile) .checklist-actions {
    padding-left: 20px;
    border-left: 1px solid #cbd5e1;
    min-height: 38px;
}

.checklist-steps {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-grow: 1;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbars on Firefox */
}
.checklist-steps::-webkit-scrollbar {
    display: none; /* Hide scrollbars on Webkit */
}

.checklist-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
}

.checklist-step:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.checklist-step.status-done {
    color: #15803d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.checklist-step.status-done:hover {
    background: #dcfce7;
    border-color: #86efac;
}
.checklist-step.status-done .step-icon {
    background: #16a34a;
    color: #ffffff;
}

.checklist-step.status-attention {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}
.checklist-step.status-attention:hover {
    background: #fef3c7;
    border-color: #fcd34d;
}
.checklist-step.status-attention .step-icon {
    background: #d97706;
    color: #ffffff;
}

.checklist-step.status-pending {
    color: #64748b;
    background: #f8fafc;
    border-color: #e2e8f0;
}
.checklist-step.status-pending:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}
.checklist-step.status-pending .step-icon {
    background: #e2e8f0;
    color: #64748b;
}

.step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.checklist-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    user-select: none;
}

.checklist-progress-label {
    white-space: nowrap;
    color: #64748b;
    font-weight: 600;
}

.checklist-progress-bar-bg {
    width: 120px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.checklist-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.checklist-progress-percent {
    font-weight: 700;
    color: #10b981;
}

.checklist-action-btn {
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #008ccf;
    background: #008ccf;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.checklist-action-btn:hover {
    background: #007bb8;
    border-color: #007bb8;
}

.checklist-action-btn:disabled {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

.checklist-action-btn-wrapper {
    display: inline-flex;
    align-items: center;
}

.checklist-action-btn-wrapper:has(button:disabled) {
    cursor: not-allowed;
}

/* --- ZWIJANE STOPNIE UKOŃCZENIA (DESKTOP) --- */
body:not(.layout-tablet):not(.layout-mobile) .checklist-steps {
    transition: max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, margin 0.4s ease;
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    white-space: nowrap;
}

body:not(.layout-tablet):not(.layout-mobile) .quote-checklist.is-expanded {
    width: 100%;
    justify-content: space-between;
    min-width: 0 !important;
    align-items: center;
}

body:not(.layout-tablet):not(.layout-mobile) .quote-checklist.is-expanded .checklist-actions {
    border-left: none;
    padding-left: 0;
}

/* --- CHECKLIST SUB-FOOTER (WYSUNIĘTA LISTA KROKÓW NAD STOPKĄ) --- */
.checklist-sub-footer {
    position: fixed;
    bottom: var(--main-footer-h, 54px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.05);
    z-index: 1999; /* Tuż za stopką (z-index 2000) */
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    padding: 6px 18px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.checklist-sub-footer.is-expanded {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

body:not(.layout-tablet):not(.layout-mobile) .app-footer:has(.quote-checklist.is-expanded) .app-footer-top-row {
    display: grid;
    grid-template-areas:
        "checklist checklist checklist checklist"
        "toggle valuation action details";
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 12px;
}

body:not(.layout-tablet):not(.layout-mobile) .app-footer:has(.quote-checklist.is-expanded) .material-panel-toggle {
    grid-area: valuation;
    width: auto;
}

body:not(.layout-tablet):not(.layout-mobile) .checklist-toggle-container {
    grid-area: toggle;
}

.action-button-container {
    display: none !important;
}

body:not(.layout-tablet):not(.layout-mobile) .action-button-container {
    grid-area: action;
    display: none !important;
}

body:not(.layout-tablet):not(.layout-mobile) .footer-details-toggle-btn {
    grid-area: details;
}

body:not(.layout-tablet):not(.layout-mobile) .quote-checklist {
    grid-area: checklist;
}

body:not(.layout-tablet):not(.layout-mobile) .quote-checklist.is-expanded .checklist-steps {
    max-width: 1000px;
    opacity: 1;
    pointer-events: auto;
    margin-right: 16px;
    flex-grow: 1;
}

.checklist-assistant-hint {
    font-size: 12px;
    color: #64748b;
    margin-right: 16px;
    font-style: italic;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.quote-checklist.is-expanded .checklist-assistant-hint {
    opacity: 1;
}

.checklist-mode-toggle-btn {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.checklist-mode-toggle-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

.checklist-mode-toggle-btn.active {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

@keyframes borderGlowPulse {
    0% { box-shadow: 0 0 0 0px rgba(0, 140, 207, 0.7); border-color: #008ccf; }
    50% { box-shadow: 0 0 0 8px rgba(0, 140, 207, 0.3); border-color: #008ccf; }
    100% { box-shadow: 0 0 0 0px rgba(0, 140, 207, 0); }
}

.control-highlight {
    animation: borderGlowPulse 1.2s ease-in-out 3;
}

.finish-selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 10px 0;
}

.finish-select-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.finish-select-card:hover {
    border-color: #008ccf;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 140, 207, 0.1);
}

.finish-swatch {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.1);
}

.finish-swatch-black {
    background: #111827;
}

.finish-swatch-white {
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.finish-swatch-ral {
    background: linear-gradient(135deg, #ef4444, #eab308, #3b82f6, #10b981);
}

.finish-card-info strong {
    display: block;
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 4px;
}

.finish-card-info small {
    display: block;
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .finish-selection-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .finish-select-card {
        flex-direction: row;
        text-align: left;
        padding: 12px;
        gap: 16px;
    }
    .finish-swatch {
        width: 44px;
        height: 44px;
        margin-bottom: 0;
    }
}

/* --- Ujednolicony UI dla Import/Export --- */
.modal-card {
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
}
.modal-card-pdf {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
}
.modal-card-pdf-disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.modal-card-pdf-disabled .modal-card-title-pdf,
.modal-card-pdf-disabled .modal-card-subtitle {
    color: #64748b;
}
.modal-card-export-warning {
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.modal-card-link {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.share-project-link-input {
    display: block;
    width: auto;
    min-width: min(420px, 100%);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 12px;
    font: 500 13px/1.35 Consolas, monospace;
    color: #334155;
    background: #f8fafc;
}
.modal-card-seed {
    background: #fffbeb;
    border: 1px solid #fde68a;
}
.modal-card-title {
    font-size: 14px;
    font-weight: 700;
}
.modal-card-title-pdf { color: #0369a1; }
.modal-card-title-link { color: #166534; }
.modal-card-title-seed { color: #b45309; }
.modal-card-subtitle {
    font-size: 11px;
    color: #475569;
    line-height: 1.4;
}
.modal-card-btn {
    height: 38px;
    padding: 0 24px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: none;
    outline: none;
    margin-top: 8px;
}
.modal-card-btn-pdf {
    background: #0284c7;
    color: #ffffff;
    border: 1px solid #0369a1;
}
.modal-card-btn-pdf:hover {
    background: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}
.modal-card-btn-pdf:disabled {
    background: #94a3b8;
    border-color: #94a3b8;
    color: #f8fafc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@keyframes pdf-generation-spin {
    to { transform: rotate(360deg); }
}
.sidebar-pdf-export-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    margin-top: 10px;
    padding: 0 12px;
    border: 1px solid #b9dff0;
    border-radius: 8px;
    background: #eef7fb;
    color: #008ccf;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}
.sidebar-pdf-export-btn.export-available {
    display: inline-flex;
}
.sidebar-pdf-export-btn:hover:not(:disabled) {
    background: #dff2fb;
    border-color: #8ecfe8;
}
.sidebar-pdf-export-btn:disabled,
.sidebar-pdf-export-btn.export-disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: .9;
}
.modal-card-btn-link {
    background: #16a34a;
    color: #ffffff;
    border: 1px solid #15803d;
}
.modal-card-btn-link:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}
.modal-card-btn-seed {
    background: #d97706;
    color: #ffffff;
    border: 1px solid #b45309;
}
.modal-card-btn-seed:hover {
    background: #b45309;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

/* Disabled quote export state (must override the legacy modal theme below). */
.modal-card-pdf-disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.modal-card-pdf-disabled .modal-card-title-pdf,
.modal-card-pdf-disabled .modal-card-subtitle {
    color: #64748b;
}
.modal-card-export-warning {
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.modal-card-btn-pdf:disabled {
    background: #94a3b8;
    border-color: #94a3b8;
    color: #f8fafc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.modal-card-pdf-disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.modal-card-pdf-disabled .modal-card-title-pdf,
.modal-card-pdf-disabled .modal-card-subtitle {
    color: #64748b;
}
.modal-card-export-warning {
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.modal-card-btn-pdf:disabled {
    background: #94a3b8;
    border-color: #94a3b8;
    color: #f8fafc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- MOBILE LAYOUT FIXES & MODERNIZATION --- */
.layout-mobile .production-programs-panel {
    padding: 0;
    background: transparent;
    border: 0;
}

.layout-mobile .production-programs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.layout-mobile .production-program-card {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 6px 10px !important;
    padding: 12px !important;
    border: 1px solid #bfd7e7 !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
    margin: 0 !important;
}

.layout-mobile .production-program-id {
    grid-column: 1;
    grid-row: 1;
}

.layout-mobile .production-program-meta {
    grid-column: 1;
    grid-row: 2;
}

.layout-mobile .production-program-segments {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    text-align: right;
    font-size: 11px;
}

.layout-mobile .production-program-values {
    grid-column: 1 / -1 !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
}

.layout-mobile .production-program-values span {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 6px 8px !important;
    font-size: 9px !important;
}

.layout-mobile .production-program-values b {
    font-size: 11px !important;
}

.layout-mobile .material-optimizer-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
}

.layout-mobile .material-optimizer-pro-controls {
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    margin-left: 0 !important;
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
}

.layout-mobile .material-stock-toggle-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-start !important;
}

/* Mobile Lock button styling overrides */
.layout-mobile .project-lock-toggle-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.layout-mobile .project-lock-toggle-btn.locked {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
}
.layout-mobile .project-lock-toggle-btn svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

/* Mobile Production Accordion drawers and inner scroll prevention */
.layout-mobile .production-programs-panel {
    height: auto !important;
    max-height: none !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
}

.layout-mobile .production-programs-list {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

.layout-mobile .material-optimizer {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.production-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}
.production-accordion-item {
    border: 1px solid #bfd7e7;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.production-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    text-align: left;
    outline: none;
}
.production-accordion-item.expanded .production-accordion-header {
    border-bottom: 1px solid #e2e8f0;
}
.production-accordion-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}
.accordion-arrow {
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    color: #64748b;
}
.production-accordion-content {
    display: none;
    padding: 16px;
}
.production-accordion-item.expanded .production-accordion-content {
    display: block;
}
.production-accordion-item.expanded .accordion-arrow {
    transform: rotate(180deg);
}

/* Project approval lock modal responsive alignment fixes */
.layout-mobile .production-approval-body {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
}

.layout-mobile #production-tech-hole-section > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
}

.layout-mobile #production-tech-hole-section > div > div:last-child {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    justify-content: flex-start !important;
}

.layout-mobile #production-tech-hole-section > div > div:last-child button {
    flex: 1 1 auto !important;
    min-width: 80px !important;
    text-align: center !important;
    padding: 8px 10px !important;
}

.layout-mobile .production-approval-shell,
.layout-mobile .production-approval-shell div,
.layout-mobile .production-approval-shell small,
.layout-mobile .production-approval-shell span,
.layout-mobile .production-approval-shell p {
    text-align: left !important;
}

@media (max-width: 599px) {
    .tutorial-card {
        padding: 12px 14px 10px !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15) !important;
        border: 1px solid rgba(189, 210, 226, 0.9) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        max-height: min(280px, calc(100vh - 32px)) !important;
    }

    .tutorial-card-title {
        font-size: 16px !important;
        margin: 2px 0 0 !important;
        font-weight: 700 !important;
    }

    .tutorial-card-kicker {
        font-size: 10px !important;
    }

    .tutorial-card-close {
        width: 24px !important;
        height: 24px !important;
        font-size: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .tutorial-card-body {
        font-size: 12.5px !important;
        line-height: 1.5 !important;
        margin-top: 6px !important;
    }

    .tutorial-card-body img {
        max-height: 80px !important;
        width: auto !important;
        margin: 6px auto !important;
        display: block !important;
    }

    .tutorial-card-footer {
        margin-top: 10px !important;
        gap: 6px !important;
    }

    .tutorial-card-progress {
        font-size: 11px !important;
    }

    .tutorial-btn {
        min-width: 68px !important;
        height: 30px !important;
        font-size: 11px !important;
        padding: 0 10px !important;
    }
}

/* Standard-only and Pro-only navigation visibility rules */
.standard-only {
    display: inline-flex !important;
}

.mobile-action-btn.standard-only {
    display: inline-grid !important;
}

.pro-mode .standard-only {
    display: none !important;
}

/* Welcome Tutorial Popup */
.welcome-tutorial-popup {
    position: fixed;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(189, 210, 226, 0.85);
    border-radius: 12px;
    padding: 10px 30px 10px 14px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    z-index: 4500;
    width: 220px;
    box-sizing: border-box;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    animation: welcome-pulse 2s infinite ease-in-out;
}

.welcome-tutorial-popup.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.welcome-tutorial-popup-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 2px;
}

.welcome-tutorial-popup-sub {
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
}

.welcome-tutorial-popup-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: 0;
    font-size: 16px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    padding: 0;
    line-height: 1;
}

.welcome-tutorial-popup-close:hover {
    background-color: #f1f5f9;
    color: #334155;
}

/* Arrow styling */
.welcome-tutorial-popup-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.welcome-tutorial-popup.arrow-top-center .welcome-tutorial-popup-arrow {
    top: -8px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent rgba(189, 210, 226, 0.85) transparent;
}
.welcome-tutorial-popup.arrow-top-center::after {
    content: '';
    position: absolute;
    top: -7px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #fff transparent;
}

.welcome-tutorial-popup.arrow-top-right .welcome-tutorial-popup-arrow {
    top: -8px;
    right: 14px;
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent rgba(189, 210, 226, 0.85) transparent;
}
.welcome-tutorial-popup.arrow-top-right::after {
    content: '';
    position: absolute;
    top: -7px;
    right: 15px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #fff transparent;
}


.layout-mobile .production-approval-shell,
.layout-mobile .production-approval-shell div,
.layout-mobile .production-approval-shell small,
.layout-mobile .production-approval-shell span,
.layout-mobile .production-approval-shell p {
    text-align: left !important;
}

@media (max-width: 599px) {
    .tutorial-card {
        padding: 12px 14px 10px !important;
        border-radius: 12px !important;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15) !important;
        border: 1px solid rgba(189, 210, 226, 0.9) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        max-height: min(280px, calc(100vh - 32px)) !important;
    }

    .tutorial-card-title {
        font-size: 16px !important;
        margin: 2px 0 0 !important;
        font-weight: 700 !important;
    }

    .tutorial-card-kicker {
        font-size: 10px !important;
    }

    .tutorial-card-close {
        width: 24px !important;
        height: 24px !important;
        font-size: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .tutorial-card-body {
        font-size: 12.5px !important;
        line-height: 1.5 !important;
        margin-top: 6px !important;
    }

    .tutorial-card-body img {
        max-height: 80px !important;
        width: auto !important;
        margin: 6px auto !important;
        display: block !important;
    }

    .tutorial-card-footer {
        margin-top: 10px !important;
        gap: 6px !important;
    }

    .tutorial-card-progress {
        font-size: 11px !important;
    }

    .tutorial-btn {
        min-width: 68px !important;
        height: 30px !important;
        font-size: 11px !important;
        padding: 0 10px !important;
    }
}

/* Standard-only and Pro-only navigation visibility rules */
.standard-only {
    display: inline-flex !important;
}

.mobile-action-btn.standard-only {
    display: inline-grid !important;
}

.pro-mode .standard-only {
    display: none !important;
}

/* Welcome Tutorial Popup */
.welcome-tutorial-popup {
    position: fixed;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(189, 210, 226, 0.85);
    border-radius: 12px;
    padding: 10px 30px 10px 14px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    z-index: 4500;
    width: 220px;
    box-sizing: border-box;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    animation: welcome-pulse 2s infinite ease-in-out;
}

.welcome-tutorial-popup.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.welcome-tutorial-popup-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 2px;
}

.welcome-tutorial-popup-sub {
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
}

.welcome-tutorial-popup-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: 0;
    font-size: 16px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    padding: 0;
    line-height: 1;
}

.welcome-tutorial-popup-close:hover {
    background-color: #f1f5f9;
    color: #334155;
}

/* Arrow styling */
.welcome-tutorial-popup-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.welcome-tutorial-popup.arrow-top-center .welcome-tutorial-popup-arrow {
    top: -8px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent rgba(189, 210, 226, 0.85) transparent;
}
.welcome-tutorial-popup.arrow-top-center::after {
    content: '';
    position: absolute;
    top: -7px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #fff transparent;
}

.welcome-tutorial-popup.arrow-top-right .welcome-tutorial-popup-arrow {
    top: -8px;
    right: 14px;
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent rgba(189, 210, 226, 0.85) transparent;
}
.welcome-tutorial-popup.arrow-top-right::after {
    content: '';
    position: absolute;
    top: -7px;
    right: 15px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #fff transparent;
}

@keyframes welcome-pulse {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Hide language/flag menu in PRO mode */
.pro-mode .lang-switcher,
.pro-mode .mobile-more-languages {
    display: none !important;
}

/* Easter Eggs: Matrix & Gravity Modes */
body.matrix-mode,
body.matrix-mode #content-wrapper,
body.matrix-mode .sidebar,
body.matrix-mode .sidebar-main-controls,
body.matrix-mode .sidebar-segments-zone,
body.matrix-mode .primary-selection-layout,
body.matrix-mode .profile-section-preview,
body.matrix-mode .sidebar-tolerance-info,
body.matrix-mode .segments-list,
body.matrix-mode .segment-card,
body.matrix-mode .segment-card-body,
body.matrix-mode .side-panel,
body.matrix-mode .side-panel-left,
body.matrix-mode #sidebar-right,
body.matrix-mode .header,
body.matrix-mode .footer,
body.matrix-mode .mobile-action-bar,
body.matrix-mode .project-modal-shell,
body.matrix-mode .project-modal-content,
body.matrix-mode .project-modal-header,
body.matrix-mode .limit-toast,
body.matrix-mode div:not(#canvas-tools):not(.canvas-tool-drawer):not(.canvas-tool-drawer-list):not(.canvas-tool-wrapper),
body.matrix-mode section,
body.matrix-mode label {
    background-color: #000000 !important;
    background: #000000 !important;
    color: #00ff00 !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2) !important;
}

body.matrix-mode * {
    color: #00ff00 !important;
    border-color: #00ff00 !important;
    text-shadow: 0 0 2px #00ff00 !important;
    font-family: monospace !important;
}

body.matrix-mode input,
body.matrix-mode select,
body.matrix-mode button,
body.matrix-mode textarea {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #00ff00 !important;
    border: 1px solid #00ff00 !important;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3) !important;
}

body.matrix-mode input[type="range"]::-webkit-slider-runnable-track {
    background: #003300 !important;
}
body.matrix-mode input[type="range"]::-webkit-slider-thumb {
    background: #00ff00 !important;
    border: 1px solid #000000 !important;
}
body.matrix-mode svg {
    filter: hue-rotate(120deg) brightness(1.3) saturate(1.8) !important;
}

body.boom-active {
    overflow: hidden !important;
}
body.boom-active #main-sidebar {
    transform: translateY(calc(100vh - 200px)) rotate(-15deg) !important;
    transition: transform 1.2s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active #params-sidebar {
    transform: translateY(calc(100vh - 180px)) rotate(12deg) !important;
    transition: transform 1.3s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active #tools-sidebar {
    transform: translateY(calc(100vh - 210px)) rotate(-8deg) !important;
    transition: transform 1.1s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active #production-sidebar {
    transform: translateY(calc(100vh - 190px)) rotate(9deg) !important;
    transition: transform 1.15s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active .header {
    transform: translateY(calc(100vh - 85px)) rotate(5deg) !important;
    transition: transform 1.0s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active .footer {
    transform: translateY(calc(100vh - 82px)) rotate(-2deg) !important;
    transition: transform 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active .mobile-action-bar {
    transform: translateY(calc(100vh - 68px)) rotate(8deg) !important;
    transition: transform 0.9s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active #canvas-tools {
    transform: translateY(calc(100vh - 100px)) rotate(35deg) !important;
    transition: transform 0.95s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active #canvas-help-btn {
    transform: translateY(calc(100vh - 70px)) rotate(-45deg) !important;
    transition: transform 0.7s cubic-bezier(0.6, -0.28, 0.735, 0.045) !important;
    z-index: 99999 !important;
}
body.boom-active #canvas-holder {
    filter: none !important;
    transition: filter 1s ease;
}

/* Matrix Mode overrides for specific components */
body.matrix-mode #canvas-tools {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

body.matrix-mode .canvas-view-mode-btn,
body.matrix-mode .canvas-tool-drawer-trigger,
body.matrix-mode .canvas-tool-btn,
body.matrix-mode #canvas-help-btn {
    background-color: #000000 !important;
    background: #000000 !important;
    border: 1px solid #00ff00 !important;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4) !important;
    color: #00ff00 !important;
    outline: none !important;
}

body.matrix-mode .app-footer,
body.matrix-mode #app_footer,
body.matrix-mode .material-panel-toggle {
    background-color: #000000 !important;
    background: #000000 !important;
    border: 1px solid #00ff00 !important;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4) !important;
    color: #00ff00 !important;
    outline: none !important;
}

body.matrix-mode .app-footer-top-row,
body.matrix-mode .footer,
body.matrix-mode .footer-peeking,
body.matrix-mode .footer-summary,
body.matrix-mode .footer-metric,
body.matrix-mode .checklist-container,
body.matrix-mode .checklist-progress-bar-bg {
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #00ff00 !important;
}

body.matrix-mode .checklist-progress-bar-fill {
    background-color: #00ff00 !important;
}

/* Global variable override for Matrix Mode to turn cyan/blue accents to green */
body.matrix-mode,
body.matrix-mode * {
    --accent-color: #00ff00 !important;
    --accent: #00ff00 !important;
    --primary-color: #00ff00 !important;
    --primary: #00ff00 !important;
    --active-color: #00ff00 !important;
    --link-color: #00ff00 !important;
    --info-color: #00ff00 !important;
    --btn-primary-bg: #00ff00 !important;
    --btn-accent-bg: #00ff00 !important;
    --theme-color: #00ff00 !important;
}

body.matrix-mode svg,
body.matrix-mode svg * {
    stroke: #00ff00 !important;
}
body.matrix-mode svg[fill]:not([fill="none"]),
body.matrix-mode svg *[fill]:not([fill="none"]) {
    fill: #00ff00 !important;
}

/* Global scrollbar styling in Matrix Mode */
body.matrix-mode *::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
}
body.matrix-mode *::-webkit-scrollbar-track {
    background: #000000 !important;
}
body.matrix-mode *::-webkit-scrollbar-thumb {
    background: #00ff00 !important;
    border-radius: 3px !important;
}
body.matrix-mode * {
    scrollbar-color: #00ff00 #000000 !important;
    scrollbar-width: thin !important;
}

/* Elegant and refined Disco Mode (accents-only cycling) */
body.disco-mode .system-btn.active,
body.disco-mode button.active,
body.disco-mode .canvas-tool-btn.active,
body.disco-mode .add-seg-btn,
body.disco-mode .template-seg-btn,
body.disco-mode .segment-card.active {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px var(--accent-color) !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

body.disco-mode .checklist-progress-bar-fill,
body.disco-mode .param-value-badge,
body.disco-mode .accent-text,
body.disco-mode .segment-card-badge {
    background-color: var(--accent-color) !important;
    transition: background-color 0.2s ease;
}

body.disco-mode input[type="range"]::-webkit-slider-thumb {
    background: #ffffff !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 8px var(--accent-color) !important;
}

body.disco-mode input[type="range"]::-webkit-slider-runnable-track {
    background: var(--accent-color) !important;
}

/* Pixelated 3D Viewport in Space Flight Mode (90s retro look) */
body.extension #viewport-3d canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width: 100% !important;
    height: 100% !important;
}

@keyframes borderGlowPulse {
    0% { box-shadow: 0 0 0 0px rgba(0, 140, 207, 0.7); border-color: #008ccf; }
    50% { box-shadow: 0 0 0 8px rgba(0, 140, 207, 0.3); border-color: #008ccf; }
    100% { box-shadow: 0 0 0 0px rgba(0, 140, 207, 0); }
}

.control-highlight {
    animation: borderGlowPulse 1.2s ease-in-out 3;
}

.finish-selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 10px 0;
}

.finish-select-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.finish-select-card:hover {
    border-color: #008ccf;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 140, 207, 0.1);
}

.finish-swatch {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 16px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.1);
}

.finish-swatch-black {
    background: #111827;
}

.finish-swatch-white {
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.finish-swatch-ral {
    background: linear-gradient(135deg, #ef4444, #eab308, #3b82f6, #10b981);
}

.finish-card-info strong {
    display: block;
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 4px;
}

.finish-card-info small {
    display: block;
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .finish-selection-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .finish-select-card {
        flex-direction: row;
        text-align: left;
        padding: 12px;
        gap: 16px;
    }
    .finish-swatch {
        width: 44px;
        height: 44px;
        margin-bottom: 0;
    }
}

/* --- Ujednolicony UI dla Import/Export --- */
.modal-card {
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
}
.modal-card-pdf {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
}
.modal-card-link {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.modal-card-seed {
    background: #fffbeb;
    border: 1px solid #fde68a;
}
.modal-card-title {
    font-size: 14px;
    font-weight: 700;
}
.modal-card-title-pdf { color: #0369a1; }
.modal-card-title-link { color: #166534; }
.modal-card-title-seed { color: #b45309; }
.modal-card-subtitle {
    font-size: 11px;
    color: #475569;
    line-height: 1.4;
}
.modal-card-btn {
    height: 38px;
    padding: 0 24px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: none;
    outline: none;
    margin-top: 8px;
}
.modal-card-btn-pdf {
    background: #0284c7;
    color: #ffffff;
    border: 1px solid #0369a1;
}
.modal-card-btn-pdf:hover {
    background: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}
.modal-card-btn-link {
    background: #16a34a;
    color: #ffffff;
    border: 1px solid #15803d;
}
.modal-card-btn-link:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}
.modal-card-btn-seed {
    background: #d97706;
    color: #ffffff;
    border: 1px solid #b45309;
}
.modal-card-btn-seed:hover {
    background: #b45309;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

/* PRO Footer Accordions */
.pro-footer-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}
.pro-accordion-item {
    border: 1px solid #bfd7e7;
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
}
.pro-accordion-item:hover {
    border-color: #90c2e4;
}
.pro-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 18px;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    text-align: left;
    outline: none;
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    transition: background 0.2s ease;
}
.pro-accordion-header:hover {
    background: #f1f5f9;
}
.pro-accordion-item.expanded .pro-accordion-header {
    border-bottom: 1px solid #e2e8f0;
    background: #f1f5f9;
}
.pro-accordion-content {
    display: none;
    padding: 16px 20px;
    background: #ffffff;
}
.pro-accordion-item.expanded .pro-accordion-content {
    display: block;
}
.pro-accordion-arrow {
    font-size: 14px;
    font-weight: bold;
    color: #64748b;
    transition: transform 0.25s ease;
    display: inline-block;
}
.pro-accordion-item.expanded .pro-accordion-arrow {
    transform: rotate(90deg);
}

/* Clean up nested cards and elements inside PRO footer accordions */
.pro-accordion-content .production-programs-list-clean {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.pro-accordion-content .production-program-card {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 0;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
}
.pro-accordion-content .production-program-card:last-child {
    border-bottom: none;
}
.pro-accordion-content .material-card {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    box-shadow: none;
    padding: 14px 0;
    background: transparent;
    margin: 0;
}
.pro-accordion-content .material-card:last-child {
    border-bottom: none;
}

/* Space Mode Clean HUD Layout & Invisible Cursor styling */
body.extension .sidebar,
body.extension .canvas-tools,
body.extension .presentation-tool-strip,
body.extension .presentation-overlay,
body.extension #canvas-help-btn,
body.extension #canvas-photo-ref-shortcut-btn,
body.extension #view-mode-btn,
body.extension .mobile-action-bar,
body.extension .mobile-header-menu-btn {
    display: none !important;
}

body.extension #viewport-3d {
    margin-bottom: var(--footer-h, 82px) !important;
    height: calc(100vh - var(--header-h, 85px) - var(--footer-h, 82px)) !important;
}

body.space-game-playing #viewport-3d,
body.space-game-playing #viewport-3d canvas {
    cursor: none !important;
}

/* Quick Mode Switch in Header */
.quick-mode-header-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    padding-left: 16px;
    border-left: 1px solid #e2e8f0;
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 22px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.switch-container input:checked + .switch-slider {
    background-color: #008ccf;
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(20px);
}

.quick-mode-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    user-select: none;
    cursor: pointer;
}

/* Sidebar Wizard Checklist Steps styling */
.sidebar-checklist-steps {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sidebar-checklist-steps .checklist-step {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
    height: 26px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 600;
    font-size: 11px;
    color: #334155;
    box-sizing: border-box;
    width: 100%;
}

.sidebar-checklist-steps .checklist-step:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.sidebar-checklist-steps .checklist-step.status-done {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.sidebar-checklist-steps .checklist-step.status-done .step-icon {
    background: #22c55e;
    color: #ffffff;
    border-color: #22c55e;
}

.sidebar-checklist-steps .checklist-step.status-attention {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.sidebar-checklist-steps .checklist-step.status-attention .step-icon {
    background: #f97316;
    color: #ffffff;
    border-color: #f97316;
}

.sidebar-checklist-steps .checklist-step.disabled {
    opacity: 0.45;
    pointer-events: none !important;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #94a3b8;
}

.sidebar-checklist-steps .checklist-step.disabled .step-icon {
    background: #e2e8f0;
    color: #94a3b8;
    border-color: #cbd5e1;
}

.sidebar-checklist-steps .step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 800;
    flex-shrink: 0;
    border: 1px solid currentColor;
}

.primary-selection-buttons.quick-mode-active .sidebar-checklist-steps.quote-checklist {
    display: flex !important;
    position: static !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
}

.primary-selection-buttons.quick-mode-active .sidebar-checklist-steps .checklist-steps {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    overflow: visible !important;
    white-space: normal !important;
}

/* Show/hide sidebar selection groups based on Quick Mode state */
.sidebar-default-selection-group {
    display: flex !important;
}
.sidebar-checklist-steps {
    display: none !important;
}

.primary-selection-buttons.quick-mode-active .sidebar-default-selection-group {
    display: none !important;
}
.primary-selection-buttons.quick-mode-active .sidebar-checklist-steps {
    display: flex !important;
}

/* Double Height Footer Adjustments & Layout Zones */
body:not(.layout-tablet):not(.layout-mobile) .app-footer-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 96px; /* align with double height */
    gap: 24px;
}

.footer-left-support-zone {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    text-align: left;
}

.footer-support-text {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.support-separator {
    margin: 0 8px;
    color: #cbd5e1;
}

.footer-version-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
}

.footer-center-metrics-zone {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    flex: 1;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    padding: 0 32px;
    margin: 0 24px;
}

#footer-center-metrics-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    width: 100%;
}

.footer-tolerance-info {
    text-align: center;
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

.footer-center-metrics-zone .material-summary-metric {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

.footer-center-metrics-zone .material-summary-metric-label {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

.footer-center-metrics-zone .material-summary-metric-value {
    font-size: 14px;
    color: #0f172a;
    font-weight: 800;
}

.footer-right-actions-zone {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}

.footer-valuation-price-container {
    display: none !important;
    align-items: baseline;
    gap: 6px;
}

.footer-price-value {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.footer-price-value:hover {
    color: #008ccf;
}

.footer-price-brutto-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: lowercase;
}

body:not(.layout-tablet):not(.layout-mobile) .checklist-action-btn {
    height: 48px;
    padding: 0 28px;
    font-size: 15px;
    border-radius: 10px;
    font-weight: 700;
}

body:not(.layout-tablet):not(.layout-mobile) .footer-details-toggle-btn {
    font-size: 13px !important;
    gap: 8px;
}

/* Aesthetic 10px spacing before the tolerance info bar in both normal and quick modes */
.primary-selection-layout {
    margin-bottom: 10px !important;
}
.sidebar-tolerance-info {
    margin: 0px 6px 0px !important;
}

/* Mobile Project Name Input styling */
.mobile-project-name-container {
    display: none;
    margin-bottom: 15px;
    padding: 0 6px;
}
.project-name-mobile-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
}
.project-name-mobile-input:focus {
    background: #ffffff;
    border-color: #008ccf;
    box-shadow: 0 0 0 3px rgba(0, 140, 207, 0.15);
}
.project-name-mobile-input:disabled {
    background: #f4f7fa;
    color: #607080;
    cursor: not-allowed;
}
.layout-mobile .mobile-project-name-container,
.layout-tablet .mobile-project-name-container {
    display: block;
}

/* Sidebar configuration accordion & grid */
.sidebar-configuration-accordion {
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease-in-out;
    margin-bottom: 5px;
}

.sidebar-configuration-accordion:hover {
    border-color: #cbd5e1;
}

.accordion-summary-header {
    padding: 12px 14px;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
    border-bottom: 1.5px solid #e2e8f0;
}

.accordion-summary-header .summary-title {
    font-size: 11px;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.accordion-summary-header .summary-details {
    font-size: 12px;
    font-weight: 600;
    color: #008ccf;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px;
}

.accordion-summary-header .accordion-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #64748b;
    transition: transform 0.2s;
}

.sidebar-configuration-accordion.expanded .accordion-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.accordion-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
    background: #f8fafc;
}

.config-action-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    height: 52px;
    box-sizing: border-box;
}

.config-action-btn:hover {
    border-color: #008ccf;
    background: #f0f9ff;
    box-shadow: 0 2px 4px rgba(0, 140, 207, 0.05);
}

.config-action-btn .btn-label {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.config-action-btn strong {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Modals galleries */
.cover-gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.cover-material-group {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    padding: 12px;
}

.cover-material-group-title {
    font-size: 13px;
    font-weight: 800;
    color: #334155;
    margin-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cover-colors-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media(max-width: 600px) {
    .cover-colors-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.gallery-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    padding: 6px;
    text-align: center;
    box-sizing: border-box;
}

.gallery-card:hover {
    border-color: #008ccf;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 140, 207, 0.1);
}

.gallery-card.active {
    border-color: #008ccf;
    background: #f0f9ff;
    box-shadow: 0 0 0 2px rgba(0, 140, 207, 0.15);
}

.gallery-card-preview {
    width: 100%;
    height: 60px;
    border-radius: 6px;
    margin-bottom: 6px;
    background-size: cover;
    background-position: center;
    border: 1px solid #f1f5f9;
}

.gallery-card-label {
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    word-break: break-word;
}

#main-sidebar.quick-mode-active .profile-section-preview {
    display: none !important;
}

#main-sidebar.quick-mode-active .primary-selection-layout {
    grid-template-columns: 1fr !important;
}

/* Accordion Ribbon styles */
.accordion-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, border-color 0.3s ease;
    opacity: 0;
    overflow: hidden;
    border-top: 1px solid transparent;
}

.accordion-body .accordion-inner {
    min-height: 0;
    overflow: hidden;
    padding: 0 12px;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-body.expanded {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    border-top: 1px solid #d7e0e9;
}

.accordion-body.expanded .accordion-inner {
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.accordion-body .segment-action-row {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    margin-bottom: 12px;
}

.accordion-body.expanded .segments-list {
    flex: 1 1 auto;
    max-height: 350px;
    overflow-y: auto !important;
    overflow-x: hidden;
}

.accordion-chevron {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Next Step Arrow indicator */
.fiszka-card.step-active::after {
    content: "▶";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #00bcff;
    transition: transform 0.2s ease-in-out;
}
.fiszka-card.step-active:hover::after {
    transform: translate(3px, -50%);
}

.fiszka-card.step-active:has(.fiszka-lock-btn)::after {
    display: none;
}

/* Shift chevron to left when active to make space for the triangle */
.fiszka-card.step-active .accordion-chevron {
    margin-right: 20px;
}

/* Canvas tools stay available in both 2D and 3D. Labels pop out as clean full-width ribbons to the left. */
#canvas-tools {
    overflow: visible !important;
}

#canvas-tools .canvas-tool-drawer {
    display: block;
    width: 45px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    overflow: visible !important;
}

#canvas-tools .canvas-tool-drawer-list {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: auto;
    gap: 7px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    overflow: visible !important;
}

#canvas-tools .canvas-tool-drawer-list::before,
#canvas-tools .canvas-tool-drawer-trigger,
#canvas-tools .active-tool-indicators {
    display: none;
}

#canvas-tools .canvas-tool-drawer-list .canvas-tool-wrapper {
    position: relative;
    width: 45px;
    height: 45px;
    overflow: visible !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

#canvas-tools .canvas-tool-drawer-list .canvas-tool-btn {
    position: relative;
    width: 45px;
    height: 45px;
    min-width: 45px;
    max-width: 45px;
    padding: 0;
    justify-content: center;
    overflow: visible !important;
    white-space: nowrap;
    margin-left: auto;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

#canvas-tools .canvas-tool-drawer-list .canvas-tool-wrapper:hover .canvas-tool-btn,
#canvas-tools .canvas-tool-drawer-list .canvas-tool-btn:hover {
    width: 45px;
    min-width: 45px;
    max-width: 45px;
    justify-content: center;
}

#canvas-tools .canvas-tool-drawer-list .canvas-tool-btn::after {
    content: attr(data-tool-title);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-width: none !important;
    width: auto !important;
    box-sizing: border-box;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 10000;
}

#canvas-tools .canvas-tool-drawer-list .canvas-tool-wrapper:hover .canvas-tool-btn::after,
#canvas-tools .canvas-tool-drawer-list .canvas-tool-btn:hover::after {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(-50%) translateX(0) !important;
}

body.matrix-mode #canvas-tools .canvas-tool-drawer-list .canvas-tool-btn::after {
    background: #020617;
    color: #00ff66;
    border-color: #00ff66;
    box-shadow: 0 0 14px rgba(0, 255, 102, 0.4);
}

.canvas-custom-tooltip {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

/* Ensure canvas tool containers are strictly transparent in Matrix mode */
body.matrix-mode #canvas-tools,
body.matrix-mode #canvas-tools .canvas-tool-drawer,
body.matrix-mode #canvas-tools .canvas-tool-drawer-list,
body.matrix-mode #canvas-tools .canvas-tool-wrapper {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Keep the quote export card disabled until the project is approved. */
.modal-card-pdf-disabled {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.modal-card-pdf-disabled .modal-card-title-pdf,
.modal-card-pdf-disabled .modal-card-subtitle {
    color: #64748b;
}
.modal-card-export-warning {
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.modal-card-btn-pdf:disabled {
    background: #94a3b8;
    border-color: #94a3b8;
    color: #f8fafc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

