html {
    overflow: hidden;
    width: 100dvw;
    height: 100dvh;
}

html, body {
    --blue: #2F3841;
    --transparent-blue: #2F384180;
    --pale-blue: #5c6e80;
    --grey: #7f7f7f;
    --light-grey: #cccccc;
    --white: #ffffff;
    --transparent-white: #ffffff80;
    --beige: #BFB588;
    --cream: #F5F1E4;
    --green: #27C419;
    --transparent-green: #27C41980;
    --red: #C80000;
    --transparent-red: #C8000080;
    --orange: #F4A941;
    --shadow: #00000080;
    --max-width: 90dvw;
    margin: 0;
    display: flex;
    flex-direction: column;
    place-items: center;
    font-family: 'Work Sans', sans-serif;
    font-size: max(0.95rem, 1vmin);
    font-weight: 300;
    color: var(--blue);
    background-color: var(--cream);
    text-align: center;
}

body {
    --mt: calc(min(30vmin, 35.9px) + 10vmin);
    margin-top: var(--mt);
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100% - var(--mt));
    width: 100%;
    scrollbar-color: var(--beige) var(--white);
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

b {
    font-weight: 500;
}

a {
    color: var(--blue);
    text-decoration: none;
    cursor: pointer;
}

a:hover {
    text-decoration: underline;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvw;
    height: 30vmin;
    max-height: 35.9px;
    background-color: var(--white);
    padding: 4vmin 0 6vmin 0;
    z-index: 1;
}

header::after {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background-color: var(--beige);
    position: absolute;
    bottom: 2vmin;
}

footer {
    min-width: 100dvw;
    min-height: 15dvh;
    position: relative;
    bottom: 0;
}

h1 {
    font-size: max(1.25rem, 2.5vmin);
    letter-spacing: 0.2vmin;
    font-weight: 300;
    max-width: var(--max-width);
    margin: 1.5em 0;
}

h1 a {
    font-weight: 400;
}

h2 {
    margin: 0 0 var(--gap) 0;
    font-size: max(0.95rem, 2.5vmin);
    letter-spacing: 0.2vmin;
    font-weight: 300;
}

p {
    max-width: var(--max-width);
}

select {
    display: block;
    padding: 0.5em;
    width: 100%;
    border: 1px solid var(--beige);
    color: var(--blue);
    outline: none;
    text-align-last: center;
    max-width: 300px;
}

form {
    display: grid;
    place-items: center;
    place-content: center;
}

input {
    padding: 0.5em;
    text-align: center;
    box-sizing: border-box;
    border: 1px solid var(--beige);
    outline: none;
    max-width: 300px;
}

input:not([type="checkbox"]) {
    width: 100%;
}

select:focus, input:focus {
    outline: auto;
}

button {
    display: block;
    border: 1px solid var(--beige);
    color: var(--blue);
    outline: none;
    background-color: var(--white);
    margin: 0.3em;
    padding: 0.7em;
    cursor: pointer;
    transition: 150ms ease;
}

button:disabled {
    background-color: var(--light-grey);
    cursor: not-allowed;
}

button:not(:disabled):hover, button:not(:disabled):focus {
    border: 1px solid var(--blue);
    color: var(--white);
    background-color: var(--beige);
}

input#authenticationToken {
    font-size: max(1rem, 2vmin);
    font-weight: 300;
    width: 20ex;
}

.houses {
    display: grid;
    position: relative;
    place-content: start center;
    width: 80vmin;
    grid-template-columns: 40vmin 40vmin;
}

.house {
    width: 100%;
    height: 100%;
    cursor: pointer;
    outline: 1px solid var(--blue);
    outline-offset: 1vmin;
    backface-visibility: hidden;
    transform: perspective(100vmin) translateZ(-20vmin);
    transform-origin: center;
    transition: 400ms ease;
    height: calc(40vmin * var(--original-height) / var(--original-width));
    place-self: center;
}

.house::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-size: cover;
}

.house:hover {
    transform: translateZ(0);
}

.forms {
    --gap: 3dvh;
    display: grid;
    grid-auto-columns: 1fr;
    gap: var(--gap);
    width: var(--max-width);
}

.order-form {
    width: var(--max-width);
}

.add-to-cart, .add-to-imposables {
    --gap: 3dvh;
    display: grid;
    grid-auto-columns: 1fr;
    gap: var(--gap);
    width: var(--max-width);
}

.table {
    position: relative;
    flex-direction: column;
    width: var(--max-width);
    display: grid;
    place-items: center;
}

.nav {
    display: flex;
    width: 100%;
    justify-content: space-between;
    margin: 0.5em 0;
}

.nav a {
    margin: 0 1em;
}

.table-container {
    position: relative;
    border: 1px solid var(--beige);
    padding: 5px;
    background-color: var(--white);
    width: calc(var(--max-width) - 10px);
    transition: 150ms ease;
}

.table-container:hover {
    border: 1px solid var(--blue);
}

.table-container::after {
    position: absolute;
    left: 10px;
    bottom: -20px;
    font-weight: 400;
}

.table-container.connected::after {
    content: 'Connecter';
    color: var(--green);
}

.table-container.disconnected::after {
    content: 'Déconnecter';
    color: var(--red);
}

.table-container.reconnecting::after {
    content: 'Reconnexion';
    color: var(--orange);
}

.order-history {
    position: absolute;
    right: 10px;
    bottom: -20px;
    font-weight: 400;
}

.table-overflow-container {
    overflow: auto;
    padding-right: 1px;
}

.history-entry:not(:first-child) {
    margin-top: 2em;
}

.table-title {
    margin-bottom: -1px;
}

.thead .th {
    background-color: var(--beige);
    color: var(--white);
    font-weight: 700;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    padding: 5px;
}

.th {
    background-color: var(--blue);
    color: var(--white);
    font-weight: 500;
}

.th + .th:not(:first-child) {
    border-left: 1px dashed var(--white);
}

.th b {
    font-weight: 700;
}

.th a {
    color: var(--white);
}

abbr {
    text-underline-position: from-font;
}

.related {
    background-color: var(--pale-blue) !important;
}

.cell {
    display: grid;
    place-items: center;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    padding: 3px;
    transition: 200ms ease;
}

.cell a {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
}

.cart-table {
    display: grid;
    grid-auto-flow: row;
    gap: 5px;
}

.table-collaborators {
    display: grid;
    grid-template-columns: 3fr 1fr 3fr 1fr 1fr 1fr 1fr;
}

.history-entry  .table-collaborators {
    grid-template-columns: 3fr 1fr 3fr 1fr 1fr 1fr;
}

.table-finishings {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr;
}

.table-delivery-fees {
    display: grid;
    grid-template-columns: 5fr 3fr 2fr;
}

.table-sums {
    display: grid;
    grid-auto-flow: column;
    outline: 1px solid var(--beige);
    outline-offset: -1px;
}

.single-column {
    grid-column: 1 / -1;
}

.makeready {
    display: grid;
    position: relative;
    grid-template-columns: 3fr 1fr 3fr 1fr 1fr [revolution] 1fr [price] 1fr;
    outline: 1px solid var(--beige);
    outline-offset: -1px;
    overflow: hidden;
}

.history-entry .makeready {
    grid-template-columns: 3fr 1fr 3fr 1fr [revolution] 1fr [price] 1fr;
}

.makeready-label {
    display: grid;
    place-content: center;
    position: absolute;
    top: 0;
    height: 1.5em;
    width: 7em;
    grid-auto-columns: 7em 0;
    grid-auto-flow: column;
    cursor: pointer;
}

.makeready-label .label {
    display: grid;
    place-content: center;
    background-color: var(--beige);
    color: var(--white);
    font-weight: 500;
    transition: 200ms ease;
}

.makeready-label:hover .label {
    color: var(--blue);
}

.makeready-label-corner {
    height: 0;
    width: 0;
    border-top: 1.5em solid var(--beige);
    border-right: 1.5em solid transparent;
    transition: 200ms ease;
}

.makeready-visual {
    display: grid;
    place-items: center;
    place-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--transparent-blue);
    cursor: pointer;
    z-index: 1;
    transition: 200ms ease;
}

.makeready-visual * {
    cursor: default;
}

.transparent {
    opacity: 0;
    pointer-events: none;
}

.order-form:not(.history-entry) .makeready.even .cell:nth-child(14n+3),
.order-form:not(.history-entry) .makeready.even .cell:nth-child(14n+4),
.order-form:not(.history-entry) .makeready.even .cell:nth-child(14n+5),
.order-form:not(.history-entry) .makeready.even .cell:nth-child(14n+6),
.order-form:not(.history-entry) .makeready.even .cell:nth-child(14n+7),
.order-form.history-entry .makeready.even .cell:nth-child(12n+3),
.order-form.history-entry .makeready.even .cell:nth-child(12n+4),
.order-form.history-entry .makeready.even .cell:nth-child(12n+5),
.order-form.history-entry .makeready.even .cell:nth-child(12n+6),
.order-form:not(.history-entry) .makeready.odd .cell:nth-child(14n+10),
.order-form:not(.history-entry) .makeready.odd .cell:nth-child(14n+11),
.order-form:not(.history-entry) .makeready.odd .cell:nth-child(14n+12),
.order-form:not(.history-entry) .makeready.odd .cell:nth-child(14n+13),
.order-form:not(.history-entry) .makeready.odd .cell:nth-child(14n+14)
.order-form.history-entry .makeready.odd .cell:nth-child(12n+9),
.order-form.history-entry .makeready.odd .cell:nth-child(12n+10),
.order-form.history-entry .makeready.odd .cell:nth-child(12n+11),
.order-form.history-entry .makeready.odd .cell:nth-child(12n+12) {
    background-color: var(--cream);
}

.makeready .cell {
    border-top: 1px dashed var(--beige);
}

.order-form:not(.history-entry) .makeready:nth-child(odd) .cell:nth-last-child(1),
.order-form:not(.history-entry) .makeready:nth-child(odd) .cell:nth-last-child(2),
.order-form.history-entry .makeready:nth-child(even) .cell:nth-last-child(1),
.order-form.history-entry .makeready:nth-child(even) .cell:nth-last-child(2) {
    background-color: var(--cream);
}

.order-form:not(.history-entry) .makeready .cell:nth-last-child(7n+8),
.order-form:not(.history-entry) .makeready .cell:nth-last-child(7n+9) {
    display: none;
}

.order-form.history-entry .makeready .cell:nth-last-child(6n+7),
.order-form.history-entry .makeready .cell:nth-last-child(6n+8) {
    display: none;
}

.makeready .cell:nth-last-child(1) {
    grid-area: price;
    grid-row-start: 1;
    grid-row-end: 999;
}

.makeready .cell:nth-last-child(2) {
    grid-area: revolution;
    grid-row-start: 1;
    grid-row-end: 999;
}

.order-form:not(.history-entry) .makeready .cell:not(:nth-child(7n+3)) {
    border-left: 1px dashed var(--beige);
}

.order-form.history-entry .makeready .cell:not(:nth-child(6n+3)) {
    border-left: 1px dashed var(--beige);
}

.order-form:not(.history-entry) .makeready .cell:nth-last-child(-n+8) {
    border-bottom: none;
}

.order-form.history-entry .makeready .cell:nth-last-child(-n+7) {
    border-bottom: none;
}

.finishing {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr;
    outline: 1px solid var(--beige);
    outline-offset: -1px;
}

.finishing:nth-child(odd) .cell {
    background-color: var(--cream);
}

.finishing .cell:not(:first-child) {
    border-left: 1px dashed var(--beige);
}

.delivery-point {
    display: grid;
    grid-template-columns: 5fr 3fr 2fr;
    outline: 1px solid var(--beige);
    outline-offset: -1px;
}

.delivery-point:nth-child(odd) .cell {
    background-color: var(--cream);
}

.delivery-point .cell:not(:first-child) {
    border-left: 1px dashed var(--beige);
}

.show-if-last {
    background-color: var(--cream);
    outline: 1px solid var(--beige);
    outline-offset: -1px;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    padding: 5px;
}

.show-if-last:not(:last-child) {
    display: none;
}

.history-entry-title .th {
    display: block;
    background-color: var(--beige);
    color: var(--blue);
}

.card {
    position: relative;
    top: var(--top);
    display: grid;
    background-color: var(--cream);
    place-items: center;
    place-content: center;
    width: 100%;
}

.verso {
    display: grid;
    place-items: center;
    place-content: center;
}

.verso-container {
    width: var(--card-width);
    height: var(--card-height);
    background-color: var(--card-color);
}

 .imposition {
    width: var(--imposition-width);
    height: var(--imposition-height);
    background-color: var(--card-color);
}

.options {
    margin-top: var(--gap);
}

label {
    display: grid;
    grid-auto-flow: column;
    place-content: center;
    place-items: center;
}

.verso svg {
    overflow: visible;
}

.verso svg text.editable {
    fill: none;
}

.verso foreignObject {
    width: 100%;
    height: 100%;
}

.verso foreignObject .input {
    position: absolute;
    outline: none;
    border: none;
    border-radius: unset;
    margin: 0;
    padding: 0;
    text-align: left;
    text-align-last: left;
    background-color: transparent;
    top: 0;
    left: 0;
    white-space: pre;
    cursor: text;
    caret-color: var(--caret-color);
    overflow: hidden;
    font-variant-ligatures: none;
}

.verso foreignObject .input:hover {
    outline: 1px dashed var(--transparent-blue) !important;
}

.verso foreignObject .input:empty {
    background-color: var(--input-background-color);
    color: var(--input-color);
}

.verso foreignObject .input:empty::before {
    content: attr(data-placeholder)
}

.verso foreignObject .input:focus::after {
    content: attr(data-auto-complete);
    color: var(--grey);
}

.verso foreignObject .toggle {
    appearance: none;
    display: block;
    position: absolute;
    background-color: transparent;
    border: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.verso input[type="range"] {
    width: 80%;
    max-width: 350px;
}

.verso .quantity {
    margin-top: 0.5em;
}

.verso .quantity::before {
    content: 'Quantité : ';
}

.verso .sum-excl {
    font-weight: 500;
}

.verso .sum-excl::before {
    content: 'Total : '
}

.imposition svg {
    position: relative;
    overflow: visible;
}

.pose foreignObject {
    --opacity: 0;
    display: grid;
    position: relative;
    overflow: visible;
}

.pose foreignObject:hover {
    outline: 1px solid var(--input-color);
    outline-offset: -1px;
}

.pose foreignObject::before {
    content: '';
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--input-background-color);
    opacity: 0;
}

.pose foreignObject:hover::before {
    opacity: 0.4;
}

.pose foreignObject:hover:after {
    content: attr(data-quantity) ' ex.';
    color: var(--white);
    font-size: 0.7em;
    opacity: 1;
    width: fit-content;
    display: inline;
    background-color: var(--blue);
    margin-left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 0.7em;
    padding: 3px 5px;
    border: 1px solid var(--white);
}

.pose foreignObject:hover::after {
    opacity: 1;
}

.pose foreignObject a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.pose text {
    pointer-events: none;
}

.quantity {
    display: grid;
    grid-auto-flow: row;
    place-items: center;
    position: relative;
    top: var(--top);
}

.delivery {
    position: relative;
    top: var(--top);
    display: grid;
    grid-auto-flow: row;
    gap: 0.3em;
    place-items: center;
}

#DPWarning {
    color: var(--orange);
    font-weight: 400;
    margin-bottom: 0;
}

#DPWarning:empty {
    display: none;
}

#DPAlert {
    color: var(--red);
    font-weight: 400;
    margin-bottom: 0;
}

#DPAlert:empty {
    display: none;
}

.changed {
    outline: 1px solid var(--orange) !important;
}

.unfilled {
    outline: 1px solid var(--red) !important;
}

.msg {
    position: fixed;
    background-color: var(--cream);
    font-weight: 400;
    padding: 2em;
    bottom: 10dvh;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--beige);
    outline: 5px solid var(--white);
    outline-offset: -6px;
    z-index: 1;
    transition: 300ms ease;
}

.msg:hover {
    border-color: var(--blue);
}

.msg.hidden {
    pointer-events: none;
    opacity: 0;
}

.excel-model {
    background-image: url('/img/excel.svg');
    width: 48px;
    height: 48px;
    place-self: center;
    cursor: pointer;
}

.excel-drop-area {
    position: fixed;
    width: 100dvw;
    height: 100dvh;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.dragging .excel-drop-area {
    pointer-events: revert;
}

.accept-file {
    background-color: var(--transparent-green);
}

.refuse-file {
    background-color: var(--transparent-red);
}

.pilote {
    --i: "0";
    --l: "0";
    display: grid;
    position: absolute;
    right: 2em;
    bottom: 2em;
    padding: 1em;
    background-color: var(--cream);
    outline: 1px solid var(--beige);
    pointer-events: all;
}

.pilote::before {
    content: 'Import en cours ' var(--i) ' / ' var(--l);
    font-weight: 500;
    margin-bottom: 1em;
}

.hidden {
    display: none !important;
}

.blink:after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--green);
    opacity: 0;
    animation: blink 200ms ease 3;
}

.buttons {
    display: grid;
    grid-auto-flow: column;
}

.edit-invoice-order-id {
    display: inline-block;
    min-width: 6em;
    background-color: var(--transparent-white);
    border: 1px solid var(--blue);
}

.saved {
    background-color: var(--green);
}

.error {
    background-color: var(--red);
}

div.module, div.moduleOut {
	display: block;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
    z-index: 100;
}

form div.module, form div.moduleOut {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
}

div.moduleOut {
	background-color: var(--shadow);
}

div.moduleIn {
	display: block;
	position: relative;
	min-width: 640px;
    max-width: 95%;
    width: max-content;
    height: max-content;
    max-height: 90%;
	background-color: var(--cream);
	top: 50%;
	left: 50%;
	transform: translateX(-50%) translateY(-50%);
}

div.moduleIn > div {
	text-align: center;
	padding-bottom: 10px;
}

div.moduleIn iframe {
    width: 95vw;
    height: 90dvh;
    border: none;
}

@media (orientation: portrait) {

    body {
        --card-width: calc(var(--max-width) * var(--original-height) / (var(--original-height) + 10));
        --card-height: calc(var(--max-width) * var(--original-height) / (var(--original-height) + 10) * (var(--original-height) / var(--original-width)));
        --card-margin: calc(var(--max-width) * var(--gutter) / (var(--original-height) + 10) * (var(--original-height) / var(--original-width)));
    }
    
    .houses {
        width: 100vmin;
    }

}

@keyframes blink {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }
    
    100% {
        opacity: 0;
    }
}

/** Version only **/

header a {
    display: block;
    position: relative;
    transform: translateY(-3px);
    z-index: 1;
}

h1 {
    margin-top: calc(136px / 2);
}