:root {
    color-scheme: dark;
    /* colors: */
    --black: rgb(0, 0, 0);
    --darker-grey: rgb(32, 32, 32);
    --dark-grey: rgb(32, 33, 36);
    --grey: rgb(41, 42, 45);
    --light-grey: rgb(73, 76, 80);
    --lighter-grey: rgb(132, 133, 136);
    --input-border-grey: rgb(133, 133, 133);
    --white: rgb(255, 255, 255);
    --dark-red: hsl(0, 100%, 30%);
    --red: hsl(0, 100%, 40%);
    --orange: hsl(45, 100%, 40%);
    --green: hsl(125, 100%, 25%);
    --blue: hsl(215, 100%, 45%);
    --light-blue: hsl(215, 100%, 65%);
    /* fonts: */
    --main-font: 'Work Sans', sans-serif;
}

/** Elements: */

html, body {
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
}

body {
    --find-list-scroll: 0;
    display: grid;
    background-color: var(--dark-grey);
    margin: 0;
    place-items: center;
    color: var(--white);
    font-family: var(--main-font);
    font-weight: 400;
    font-size: 0.9rem;
}

h2 {
    line-height: calc(2 / 1.5) !important;
}

button {
    appearance: none;
    background-color: var(--grey);
    color: var(--lighter-grey);
    border: 1px solid var(--light-grey);
    padding: 2px 1em;
}

button:not(:disabled) {
    cursor: pointer;
}

button:not(:disabled):hover, button:not(:disabled):focus {
    background-color: var(--darker-grey);
    color: var(--white);
    outline: none;
}

button.active:not(:disabled), button:not(:disabled):active {
    background-color: var(--black);
    color: var(--white);
}

a {
    appearance: none;
    background-color: var(--grey);
    color: var(--lighter-grey);
    cursor: pointer;
}

a:hover, a:focus {
    background-color: var(--darker-grey);
    color: var(--white);
    outline: none;
}

a.active, a:active {
    background-color: var(--black);
    color: var(--white);
}

input {
    text-align: center;
}

input[type="number"] {
    text-indent: 2ch;
}

input:read-only, input:disabled {
    border-color: transparent;
    outline: none;
    background: none;
    cursor: default;
}

label {
    display: grid;
    text-align: center;
    grid-auto-flow: column;
    grid-template-columns: 1fr 1fr;
}

/** Classes only: */

.revert {
    all: revert;
}

.text-center {
    text-align: center;
}

.login {
    display: grid;
    place-items: center;
}

.main {
    display: grid;
    place-items: center;
    width: 100%;
    height: calc(100% - 3em);
    overflow: hidden;
    padding: 0 0 3em 0;
    grid-template-rows: repeat(2, 1fr);
}

.float-left {
    float: left;
}

.float-right {
    float: right;
}

.top-side {
    display: flex;
    flex-direction: column;
    width: calc(100% - 2em);
    height: calc(100% - 2em);
    overflow: auto;
    gap: 0.2em;
    padding: 1em;
}

.bottom-side {
    width: 100%;
    height: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    place-items: center;
    overflow: auto;
}

.left-side, .right-side {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    place-items: center;
    overflow: auto;
}

.add-form-target {
    display: none;
}

.find-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    gap: 0.2em;
    overflow: auto;
}

.find-input {
    text-align: center;
}

.add {
    display: flex;
    flex-direction: column;
    width: calc(100% - 2em);
    max-width: 800px;
    height: calc(100% - 2em);
    overflow: auto;
    gap: 0.5em;
    padding: 1em;
}

.current-quantity {
    text-align: center;
    margin: 0;
}

.status {
    position: absolute;
    bottom: 1em;
    left: 1em;
    width: 1em;
    height: 1em;
    z-index: 999;
    border-radius: 1em;
}

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

.status.reconnecting {
    background-color: var(--orange);
}

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

.status__disconnect-btn {
    display: grid;
    grid-auto-flow: column;
    white-space: pre;
    margin-left: 1.5rem;
    place-content: center start;
    height: 100%;
    cursor: default;
    color: var(--lighter-grey);
}

.status.connected .status__disconnect-btn:hover {
    text-decoration: underline
}

.status.connected .status__disconnect-btn {
    pointer-events: all;
    cursor: pointer;
    color: var(--white);
}

.find-list__paper {
    display: grid;
    grid-auto-flow: column;
    text-align: center;
    grid-auto-columns: 1fr;
}

.find-list__paper > *:first-child {
    border-left: 1px solid var(--light-grey);
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
}

.find-list__paper > * {
    border-top: 1px solid var(--light-grey);
    border-bottom: 1px solid var(--light-grey);
}

.find-list__paper > *:last-child {
    border-right: 1px solid var(--light-grey);
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
}

.title {
    font-weight: 600;
    line-height: 2;
    text-align: center;
}

.find-list__paper.title {
    width: calc(100% - var(--find-list-scroll) * 17px);
}

.find-list__paper.title > * {
    border: none;
}

.find-list__paper:not(.title) > * {
    cursor: pointer;
}

.find-list__paper:not(.title):hover > * {
    background-color: var(--light-grey);
    border-color: var(--lighter-grey);
}

.history {
    display: flex;
    flex-direction: column;
    width: calc(100% - 2em);
    max-width: 800px;
    height: calc(100% - 2em);
    overflow: auto;
    gap: 0.2em;
    padding: 1em;
}

.sort-option {
    cursor: pointer;
    white-space: nowrap;
}

.selected-sort-option::after {
    content: '<';
    display: inline-block;
    color: var(--orange);
    margin-left: 1ch;
    font-weight: 700;
}

[data-order="1"] .selected-sort-option::after {
    transform: rotate(90deg);
}

[data-order="-1"] .selected-sort-option::after {
    transform: rotate(-90deg);
}

.history-paper-link {
    color: var(--blue);
    font-weight: 700;
    cursor: pointer;
}

.history-paper-link:not(:empty)::before {
    content: '[';
}

.history-paper-link:not(:empty)::after {
    content: ']';
}

.history-paper-link:hover {
    color : var(--light-blue);
    text-decoration: underline;
}

.no-paper-remaining {
    color: var(--red);
}