* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #0f171d;
    color: #e9f0e5;
    overflow: hidden
}

.topbar {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: linear-gradient(180deg, #172129, #0e151b);
    border-bottom: 1px solid rgba(255, 255, 255, .08)
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: #78cf45;
    font-size: 18px
}

.brand span {
    font-size: 12px;
    color: #9ab98d
}

.top-actions {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap
}

.sep {
    height: 24px;
    width: 1px;
    background: rgba(255, 255, 255, .16);
    margin: 0 4px
}

button,
.file-btn {
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 5px;
    padding: 8px 11px;
    background: #1d2b35;
    color: #eef6ea;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px
}

.file-btn input {
    display: none
}

button:hover,
.file-btn:hover {
    background: #29404f
}

button.active {
    background: #4f9c31
}

.danger {
    background: #9e372d !important;
    color: #fff !important
}

.app-shell {
    display: grid;
    grid-template-columns: 210px minmax(550px, 1fr) 280px;
    height: calc(100vh - 50px)
}

.left-panel,
.right-panel {
    background: linear-gradient(180deg, #1f2c36, #15212a);
    padding: 16px;
    border-right: 1px solid rgba(255, 255, 255, .08);
    overflow: auto
}

.right-panel {
    border-right: 0;
    border-left: 1px solid rgba(255, 255, 255, .08)
}

h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 12px 0 10px;
    color: #f0f5ec
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px
}

.tool {
    display: flex;
    justify-content: flex-start;
    background: transparent;
    color: #eaf1e8;
    border: 1px solid transparent;
    text-align: left;
    padding: 8px 9px
}

.tool.active {
    background: #4c8e31;
    border-color: #5eaf40
}

.tool:hover {
    background: #273946
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin: 10px 0 5px;
    color: #e9f0e5
}

input,
select {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 4px;
    background: #111b22;
    color: #edf5eb
}

.check {
    display: flex;
    gap: 8px;
    align-items: center
}

.check input {
    width: auto
}

.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.panel-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px
}

.selected-info {
    padding: 10px;
    border-radius: 6px;
    background: #111b22;
    border: 1px solid rgba(255, 255, 255, .08);
    color: #78cf45;
    font-weight: 700;
    font-size: 13px
}

.summary {
    font-size: 13px;
    line-height: 1.55;
    background: #111b22;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 6px;
    padding: 10px;
    color: #edf5eb
}

.small {
    font-size: 12px;
    color: #5b6758;
    line-height: 1.4
}

.workspace {
    position: relative;
    padding: 10px;
    overflow: auto;
    background: #eef2ec
}

.hint {
    display: none !important
}

#plan {
    display: block;
    background: white;
    border: 1px solid #cdd9c7;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
    cursor: default;
    image-rendering: auto;
    margin: auto
}

#view3d {
    display: none;
    width: 100%;
    height: calc(100vh - 98px);
    background: #d7e4d2;
    border: 1px solid #cdd9c7;
    overflow: hidden
}

.split3d {
    height: 330px !important;
    margin-top: 10px
}

#fallback3d {
    width: 100%;
    height: 100%
}

.context-menu {
    display: none;
    position: absolute;
    z-index: 20;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #cbd5c7;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
    padding: 6px;
    min-width: 210px
}

.context-menu button {
    display: flex;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    margin: 2px 0;
    background: transparent;
    color: #1e2b1f;
    border: 0
}

.context-menu button:hover {
    background: #dfead8
}

.context-menu span {
    opacity: .6;
    margin-left: 16px
}

footer {
    height: 28px;
    padding: 7px 15px;
    background: #111a21;
    color: #b9c7b4;
    font-size: 12px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, .08)
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, .42);
    align-items: center;
    justify-content: center
}

.modal-box {
    width: min(440px, 92vw);
    background: white;
    color: #172017;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, .25)
}

.modal-box h2 {
    color: #172017;
    margin: 0 0 8px
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 14px
}

.dim-row {
    display: grid;
    grid-template-columns: 1fr 125px;
    gap: 10px;
    align-items: center;
    margin: 9px 0
}

.dim-row label {
    margin: 0;
    color: #172017
}

.dim-row input {
    margin: 0;
    color: #172017;
    background: #fbfdf9;
    border-color: #c9d5c3
}

@media print {
    body {
        background: white;
        overflow: visible
    }

    .topbar,
    .left-panel,
    .right-panel,
    .hint,
    footer,
    #view3d {
        display: none !important
    }

    .app-shell {
        display: block;
        height: auto
    }

    .workspace {
        padding: 0;
        overflow: visible;
        background: white
    }

    #plan {
        border: 0;
        box-shadow: none;
        max-width: 100%;
        height: auto
    }

}

.main-select {
    margin-bottom: 10px;
    width: 100%;
    background: #263944
}

.object-drawer {
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding-top: 8px;
    margin-top: 6px
}

.object-drawer summary {
    cursor: pointer;
    padding: 8px 9px;
    border-radius: 5px;
    background: #16232b;
    color: #eef6ea;
    font-weight: 700;
    font-size: 12px;
    list-style: none
}

.object-drawer summary::-webkit-details-marker {
    display: none
}

.object-drawer summary:before {
    content: '▸';
    display: inline-block;
    margin-right: 8px;
    transition: .15s
}

.object-drawer[open] summary:before {
    transform: rotate(90deg)
}

.object-drawer .tool-grid {
    margin-top: 8px
}

.print-options {
    display: grid;
    gap: 10px;
    margin-top: 14px
}

.print-options button {
    padding: 11px;
    background: #315b25
}

.print-area {
    display: none
}

@media print {
    body {
        background: white !important;
        overflow: visible !important
    }

    .topbar,
    .project-bar,
    .app-shell,
    footer,
    .modal-backdrop,
    .zoom-controls {
        display: none !important;
    }

    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        overflow: visible !important;
    }

    .print-area {
        display: block !important;
        width: 100%;
        height: 100%;
        margin: 0 !important;
        padding: 0 !important;
        background: white;
        color: #111;
    }

    .print-page {
        break-after: auto;
        page-break-after: auto;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .print-page:last-child {
        break-after: auto;
        page-break-after: auto
    }

    .print-page h1 {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 15px;
        margin: 0 0 5mm;
        color: #111
    }

    .print-page img {
        max-width: 96%;
        max-height: 86vh;
        object-fit: contain;
    }

    @page {
        size: A4 landscape;
        margin: 8mm;
    }

}

.library-search {
    margin: 8px 0 6px;
    font-size: 12px
}

.library-panel {
    display: grid;
    gap: 8px;
    margin-top: 8px
}

.lib-category {
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 7px;
    background: #121f27;
    overflow: hidden
}

.lib-category summary {
    background: #20313c !important;
    color: #dff0d5 !important
}

.lib-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 7px
}

.lib-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 7px;
    align-items: center;
    width: 100%;
    padding: 7px 8px;
    text-align: left;
    background: #17262f;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 5px;
    color: #edf5eb
}

.lib-item:hover {
    background: #29404f
}

.lib-item.active {
    background: #4c8e31;
    border-color: #70bd51
}

.lib-swatch {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, .35);
    background: var(--swatch);
    background-image: var(--texture);
    background-size: 10px 10px
}

.lib-name {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15
}

.lib-meta {
    display: block;
    font-size: 10px;
    opacity: .7;
    font-weight: 500;
    margin-top: 2px
}



/* Curseur standard de souris, plus précis pour placer les objets */
#plan,
#view3d,
#fallback3d {
    cursor: default !important;
}

/* Barre de zoom interne du plan */
.zoom-controls {
    position: sticky;
    left: 12px;
    bottom: 12px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    max-width: calc(100% - 24px);
    margin: 10px 0 0 10px;
    padding: 8px 10px;
    background: rgba(17, 27, 34, .94);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    color: #edf5eb;
    font-size: 12px;
}

.zoom-controls label {
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
}

.zoom-controls input[type="range"] {
    width: 170px;
    padding: 0;
}

.zoom-controls input[type="number"] {
    width: 64px;
    padding: 6px 7px;
    text-align: right;
}

.zoom-controls button {
    padding: 6px 9px;
    min-width: 32px;
}

@media print {
    .zoom-controls {
        display: none !important;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #78cf45;
}

.brand-logo {
    height: 46px;
}

/* Import d'image dans le plan */
#imageImport {
    display: none;
}

/* Menu supérieur organisé */
.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.menu-dropdown {
    position: relative;
}

.menu-trigger {
    min-width: 100px;
}

.menu-content {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 80;
    min-width: 190px;
    padding: 7px;
    background: #111b22;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 9px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
}

.menu-dropdown:hover .menu-content,
.menu-dropdown:focus-within .menu-content {
    display: grid;
    gap: 6px;
}

.menu-content button,
.menu-content .menu-file {
    width: 100%;
    display: block;
    text-align: left;
    padding: 9px 10px;
    border-radius: 6px;
    background: transparent;
    border: 0;
    color: #eef6ea;
}

.menu-content button:hover,
.menu-content .menu-file:hover {
    background: #29404f;
}

.icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    font-size: 20px;
    line-height: 1;
}

/* Palette d'outils façon Photofiltre */
.tool-palette {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    gap: 7px;
    margin: 8px 0 14px;
    padding: 8px;
    border-radius: 8px;
    background: #111b22;
    border: 1px solid rgba(255, 255, 255, .10);
}

.tool-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 5px;
    background: #20313c;
    color: #eef6ea;
    border: 1px solid rgba(255, 255, 255, .14);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.tool-icon:hover {
    background: #29404f;
}

.tool-icon.active {
    background: #4c8e31;
    border-color: #70bd51;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.tool-icon[aria-label="Texte"] {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 20px;
}

@media (max-width: 760px) {
    .tool-palette {
        grid-template-columns: repeat(3, 36px);
    }

    .tool-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
}

/* Nom du projet dans la barre du haut */
.project-name-top {
    width: 260px;
    min-width: 220px;
    max-width: 320px;
    height: 38px;
    padding: 0 12px;
    margin: 0 2px 0 0;
    border-radius: 8px;
    background: #111b22;
    color: #edf5eb;
    border: 1px solid rgba(255, 255, 255, .16);
    font-weight: 700;
}

.project-name-top::placeholder {
    color: rgba(237, 245, 235, .62);
}

@media (max-width: 900px) {
    .project-name-top {
        width: 190px;
        min-width: 160px;
    }
}
