html, body {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    font-family: sans-serif;
}
body {
    display: flex;
    flex-direction: column;
}

nav {
    display: flex;
    position: relative;
}
nav.bar {
    justify-content: space-between;
    align-items: center;
    padding: 0.5em;
    background: var(--clr-bg-2);
}
nav.dropdown {
    flex-direction: column;
    display: none;
    overflow: hidden;

    /*border: 1px solid #999;
    border-radius: 3px;
    background: #eee;*/
}

aside.dialog {
    display: none;
}

button {
    font-family: sans-serif;
    font-size: inherit;
    /*border: 1px solid #999;
    border-radius: 3px;
    background: #eee;
    padding: 0.7em 0.5em 0.8em;
    margin: 0;
    line-height: 1;*/
    cursor: pointer;
    position: relative;
}

nav.dropdown>button {
    justify-content: flex-start;
    margin: 3px;
}
nav.dropdown>button+button {
    margin-top: 0;
}
nav.dropdown>.spacer {
    height: 0;
    width: 100%;
    border-bottom: 1px solid var(--clr-bg-3);
}

nav.dropdown {
    display: none;
    background: var(--clr-bg-1)
}
nav.dropdown[open] {
    position: absolute;
    top: 100%; left: 0%;
    z-index: 1;
    display: flex;
}

dialog[open] {
    z-index: 1;
    margin-top: 5em;
}
dialog[open]::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: -1;
}
dialog>.dialog-body {
    background: var(--clr-bg-1);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.btn[disabled] { opacity: 0.5; cursor: default; }
.btn>img { height: 1em; }
.btn>img:not(:last-child) { margin-right: 0.5em; }
.btn>img:first-child { margin-left: -0.25em; }
.btn>img:last-child { margin-right: -0.25em; }
.dark-theme .btn>img { filter: invert(100%); }
.btn.pressed { background-color: var(--clr-btn-pressed) !important; }

.reorder-button { display: inline-block; padding-top: 0.5em; padding-bottom: 0.5em; margin-right: 0.75em; margin-bottom: 1em; }
.reorder-button img { height: 5em; margin-top: 0.5em; margin-right: 0 !important; }
.reorder-button:not(:is(:active, :hover))>img:first-of-type+img, .reorder-button:is(:active, :hover)>img:first-of-type {
    display: none;
}

.list-element.activable { text-decoration: none; cursor: pointer; }

.spinnable > .spinner {
    position: absolute;
    display: none;
}
.spinnable.spinning > .spinner {
    display: flex;
}
.spinnable.spinning > :not(.spinner) {
    opacity: 0;
}
.btn.primary.spinnable > .spinner {
    --clr-spinner-bg: #fff;
    --clr-spinner-fg: var(--clr-primary-300);
}

main {
    flex: 1;
    display: flex;
    padding: 1rem; gap: 1rem;
    overflow: scroll;
    overflow-y: hidden;
    align-items: center;
}
main>* {
    flex: none;
    display: flex;
    justify-content: center;
    overflow: hidden;
    max-height: 100%;
    min-width: 100px;
    min-height: 100px;
    height: 100%;
}
main>*>* {
    flex: none;
    max-width: 100%;
    max-height: 100%;
}
#pagesPreview {
    background: var(--clr-bg-1);
}
#pagesPreview>div {
    border: 1px solid var(--clr-bg-6);
    box-shadow: 0 0 0 2px var(--clr-bg-6);
    background: var(--clr-bg-2);
    border-radius: 1px;
}
#pagesPreview>div.focused {
    border-color: var(--clr-primary-300);
    box-shadow: 0 0 0 4px var(--clr-primary-300);
}
#pagesPreview>div>* {
    height: 100%;
}
#pagesPreview>div:not(.cropping)>cropper-canvas,
#pagesPreview>div.cropping>canvas {
    display: none;
}
#pagesPreview>div>canvas {
    image-rendering: pixelated;
}
cropper-selection[outlined] {
    outline-width: 2px !important;
    outline-color: var(--clr-primary-300);
}
cropper-handle:not([action="move"]) {
    --theme-color: var(--clr-primary-300);
}
cropper-handle::after {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}