/* The desktop Free Draw frame uses the same controls and colours as Floor Plan View. */
@media (min-width: 901px) {
    html, body {
        background: #102a43;
        color: #fff;
        height: 100%;
    }
    html:not(.free-draw-ready) #appShell > main {
        visibility: hidden;
    }
    #appShell.free-draw-shell > .page-header {
        display: flex;
        height: 138px;
        min-height: 138px;
        padding: 0 22px;
        background: #102a43;
    }
    #appShell.free-draw-shell > .page-header > a {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    #appShell.free-draw-shell > .page-header > a img {
        width: 360px;
        max-width: calc(100vw - 90px);
    }
    #appShell.free-draw-shell .header-actions a,
    #appShell.free-draw-shell #desktopDrawingHeader,
    #appShell.free-draw-shell .page-title,
    #appShell.free-draw-shell .intro,
    #appShell.free-draw-shell .scope-note,
    #appShell.free-draw-shell #drawingToolbar,
    #appShell.free-draw-shell #stepTwoDrawer > summary,
    #appShell.free-draw-shell #measurementForm > :is(label, select, p),
    #appShell.free-draw-shell #result {
        display: none !important;
    }
    #appShell.free-draw-shell .header-actions {
        margin-left: auto;
        margin-right: 48px;
    }
    #appShell.free-draw-shell .header-actions span {
        font: 10px/14px 'Sansita', Arial, sans-serif;
        color: #aebcc8;
    }
    #appShell.free-draw-shell main.work-layout {
        display: grid !important;
        grid-template-columns: 250px minmax(0, 1fr) !important;
        min-height: 0;
        height: calc(100dvh - 138px) !important;
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden !important;
    }
    #appShell.free-draw-shell #controls {
        height: 100%;
        padding: 12px !important;
        border: 0;
        overflow-y: auto !important;
    }
    #appShell.free-draw-shell #workspace {
        height: 100%;
        padding: 12px 14px 31px !important;
        overflow: hidden !important;
        background: #102a43;
    }
    #appShell.free-draw-shell #workspace > .panel {
        height: 100%;
        display: flex;
        flex-direction: column;
        padding: 20px;
        margin: 0;
        border: 0;
        border-radius: 12px;
        background: #fff;
        color: #000;
    }
    #appShell.free-draw-shell #workspace .title-row {
        display: flex;
        flex: 0 0 30px;
        flex-direction: row;
        min-height: 30px;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-width: 0;
        margin: 0 0 12px;
    }
    #appShell.free-draw-shell #workspace .title-row h2 {
        margin: 0;
        color: #000;
        font: 700 clamp(16px, 1.6vw, 22px)/1.25 'Sansita', Arial, sans-serif;
        text-transform: uppercase;
    }
    #appShell.free-draw-shell .free-draw-page-actions {
        display: flex;
        align-items: center;
        gap: 5px;
        flex: 0 0 auto;
    }
    #appShell.free-draw-shell .free-draw-page-actions > button {
        position: static !important;
        width: auto !important;
        min-width: 64px;
        height: 30px;
        min-height: 30px;
        padding: 5px 10px;
        font: 10px/13px 'Sansita', Arial, sans-serif;
        border-radius: 6px;
    }
    #appShell.free-draw-shell #workspace .floor-work {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 255px !important;
        grid-template-rows: minmax(0, 1fr);
        flex: 1 1 0;
        align-items: stretch;
        gap: 14px !important;
        width: 100%;
        min-height: 0;
    }
    #appShell.free-draw-shell #canvas.canvas-wrap {
        position: relative;
        grid-column: 1;
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100% !important;
        padding: 0 !important;
        border: 0;
        border-radius: 6px;
        overflow: hidden;
        background: #cdcdcd !important;
    }
    #appShell.free-draw-shell #drawingCard {
        width: 100%;
        height: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    #appShell.free-draw-shell #drawing {
        width: 100%;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
        background: #cdcdcd;
        touch-action: none;
    }
    #appShell.free-draw-shell .results-rail {
        min-height: 0;
        min-width: 0;
        max-height: 100%;
        overflow-y: auto;
        padding: 0;
        border: 0;
        background: transparent;
    }
    #appShell.free-draw-shell .measurement-card {
        width: 100%;
        max-height: none;
        height: auto;
        padding: 10px;
        margin: 0;
        border: 1px solid #f28c18;
        border-radius: 10px;
        color: #fff;
        background: #102a43;
        overflow: visible;
    }
    #appShell.free-draw-shell .measurement-card h3 {
        color: #fff;
    }
    #appShell.free-draw-shell #wallMeasurementResults > div {
        grid-template-columns: 66px minmax(0, 1fr);
    }
    #appShell.free-draw-shell #wallMeasurementResults > div > b {
        white-space: nowrap;
        overflow-wrap: normal;
    }
    #appShell.free-draw-shell .measurement-card #stepTwoDrawer {
        padding: 0;
        margin: 0;
        border: 0;
    }
    #appShell.free-draw-shell #stepTwoDrawer .step-content {
        display: block;
        padding: 0;
    }
    #appShell.free-draw-shell #wallFields {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin: 0;
    }
    #appShell.free-draw-shell .wall-field {
        margin: 0;
        padding: 0;
    }
    #appShell.free-draw-shell .wall-field label {
        display: block;
        margin: 0 0 3px;
        color: #fff;
        font: 12px/15px 'Sansita', Arial, sans-serif;
    }
    #appShell.free-draw-shell .wall-field small {
        display: none;
    }
    #appShell.free-draw-shell .wall-field input {
        height: 30px;
        min-height: 30px;
        padding: 4px 5px;
        font: 12px/16px Arial, sans-serif;
    }
    #appShell.free-draw-shell .measurement-card .calculate-button {
        min-height: 30px;
        font-size: 11px;
        padding: 6px;
        margin-top: 8px;
        white-space: normal;
    }
    #appShell.free-draw-shell #applyMeasurementsButton {
        display: none;
    }
    #appShell.free-draw-shell #message {
        display: none;
    }
    #appShell.free-draw-shell #freeDrawInstructions #message {
        display: block;
        padding: 0;
        border: 0;
        background: transparent;
        color: #fff;
    }
    #appShell.free-draw-shell #grid path {
        stroke: #8d9aa6;
    }
    #appShell.free-draw-shell .measurement-card:has(#stepTwoDrawer:not([hidden])) #message {
        display: block;
        margin: 8px 0 0;
        padding: 0;
        border: 0;
        color: #fff;
        background: transparent;
        font: 11px/15px 'Sansita', Arial, sans-serif;
        overflow-wrap: anywhere;
    }
    #appShell.free-draw-shell .desktop-drawer-menu > .desktop-drawer-row {
        margin-top: 0;
    }
    #appShell.free-draw-shell .desktop-drawer-menu .desktop-drawer-content {
        padding: 8px !important;
    }
    #appShell.free-draw-shell #controls #freeDrawEditTools .desktop-drawer-content {
        padding: 5px !important;
    }
    #appShell.free-draw-shell #controls .tile-fields {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
        margin: 0;
    }
    #appShell.free-draw-shell #controls .tile-fields input {
        display: block;
        height: 27px;
        min-height: 27px;
        padding: 3px 5px;
        margin-top: 4px;
        border: 1px solid #c9d0d6;
        border-radius: 6px;
        font-size: 12px;
    }
    #appShell.free-draw-shell #controls #freeDrawInstructions :is(p, span, label, small),
    #appShell.free-draw-shell #controls .tile-help,
    #appShell.free-draw-shell #controls .drawing-position-help {
        white-space: normal !important;
        overflow-wrap: anywhere;
        color: #fff;
        font: 11px/16px 'Sansita', Arial, sans-serif;
    }
    #appShell.free-draw-shell #controls .drawing-footer {
        display: grid;
        gap: 8px;
        padding: 0;
        margin: 8px 0;
        border: 0;
    }
    #appShell.free-draw-shell #controls #drawingHelp {
        display: block;
    }
    #appShell.free-draw-shell #controls #closeButton {
        width: 100%;
        min-height: 30px;
        padding: 5px;
        font-size: 11px;
    }
    #appShell.free-draw-shell #drawing.is-measured .room-fill {
        fill: #000;
        stroke: none;
    }
    #appShell.free-draw-shell #drawing.is-measured .room-fill:has(~ .free-draw-tiles) {
        fill: none;
    }
    #appShell.free-draw-shell .tile-grout-background {
        fill: #000;
    }
    #appShell.free-draw-shell .free-draw-tile {
        fill: #fff;
        stroke: #000;
        stroke-width: 0.5;
    }
    #appShell.free-draw-shell #drawing.is-measured .corner {
        display: none;
    }
    #appShell.free-draw-shell #drawing.is-measured .wall-label {
        fill: #000;
        stroke: #cdcdcd;
    }
    #appShell.free-draw-shell .tile-centre-reference {
        fill: none;
        stroke: #a535ff;
        stroke-width: 2px;
        stroke-dasharray: 7px 5px;
        vector-effect: non-scaling-stroke;
        pointer-events: none;
    }
    #appShell.free-draw-shell #drawing.is-movable {
        cursor: grab;
    }
    #appShell.free-draw-shell #drawing.is-movable:active {
        cursor: grabbing;
    }
    .free-draw-rotation-dialog {
        width: min(420px, calc(100vw - 40px));
        padding: 22px;
        color: #fff;
        background: #102a43;
        border: 1px solid #f28c18;
        border-radius: 10px;
    }
    .free-draw-rotation-dialog::backdrop {
        background: #0008;
    }
    .free-draw-rotation-dialog h2 {
        margin: 0 0 12px;
        font: 700 20px/26px 'Sansita', Arial, sans-serif;
    }
    .free-draw-rotation-dialog p {
        font: 14px/20px 'Sansita', Arial, sans-serif;
    }
    .free-draw-rotation-dialog .dialog-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 18px;
    }
    .free-draw-rotation-dialog button {
        min-height: 34px;
        padding: 7px 12px;
        font-size: 12px;
        background: #102a43;
        border: 1px solid #f28c18;
        color: #fff;
    }
}

@media (min-width: 901px) {
    #appShell.free-draw-shell .free-draw-project-host {
        position: static;
    }
    #appShell.free-draw-shell #controls .desktop-project-information {
        width: 100%;
        margin-bottom: 0;
    }
    .free-draw-project-dialog {
        width: min(520px, calc(100vw - 40px));
        max-height: 85vh;
        overflow: auto;
    }
    .free-draw-project-fields {
        display: grid;
        gap: 10px;
    }
    .free-draw-project-fields label {
        display: grid;
        gap: 5px;
        color: #fff;
        font: 12px/16px 'Sansita', Arial, sans-serif;
    }
    .free-draw-project-fields :is(input, textarea) {
        width: 100%;
        box-sizing: border-box;
        background: #fff;
        color: #102a43;
        padding: 7px;
        border: 1px solid #c9d0d6;
        border-radius: 5px;
    }
    .free-draw-project-dialog .dialog-actions {
        flex-wrap: wrap;
    }
}

@media (min-width: 901px) {
    #appShell.free-draw-shell #closeButton {
        display: none !important;
    }
    #appShell.free-draw-shell .internal-corner-angle {
        pointer-events: none;
    }
    #appShell.free-draw-shell #controls #freeDrawInstructions .desktop-drawer-choice span {
        color: inherit;
        font: inherit;
    }
    #appShell.free-draw-shell #freeDrawInstructions .desktop-drawer-choice {
        font-size: 12px;
        white-space: normal;
    }
}
