@font-face {
    font-family: "Open Sans";
    src: url(OpenSans.ttf);
}

* {
    -webkit-tap-highlight-color: transparent;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number], input[type=text], input[type=password] {
    display: block;
    margin: 0;
    -moz-appearance: textfield;
    background-color: transparent;
    border: none;
    border-bottom: solid 1px var(--lightgrey);
    border-radius: .5rem .5rem 0 0;
    background-color: var(--grey2);
    height: 3rem;
    color: white;
    font-size: 1.5rem;
    font-weight: 300;
    width: 3em;
    font-family: inherit;
    text-align: center;
}

input.error {
    border-bottom: solid 1px var(--red);
}

.session-end-form {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin: 1rem 0;
}

#session-people {
    font-size: 1.125rem;
}

#session-comment {
    font-size: 1.125rem;
    width: auto;
    flex-grow: 1;
    text-align: left;
    padding: 0 .5rem;
}

input#custom-price {
    width: 6em;
}

:root {
    --green: rgb(25, 135, 84);
    --yellow: rgb(225,206,68);
    --red: #ce0000;

    --grey1: rgb(30,32,33);
    --grey2: rgb(45,48,50);
    --grey3: rgb(75,80,84);

    --lightgrey: rgb(227, 227, 227);

    --background: #101010;
}

* {
    margin: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

a {
    color: #fff;
    text-decoration: none;
}

svg {
    display: block;
}

html {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    height: 100%;
    font-weight: 300;

}

body {
    background-color: var(--background);
    color: #fff;
    font-family: "Open Sans", Arial, Helvetica, sans-serif;
    height: 100%;
    overflow: hidden;
}

#app {
    height: 100%;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow-x: hidden;
}

#app > * {
    height: 100%;
    width: 100%;
    position: fixed;
    transition: left .25s ease-in-out;
}

.main-panel {
    display: flex;
    flex-direction: row;
    left: -100%;
}

.checkout-panel {
    left: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

.checkout-panel:not(.active) * {
    scroll-behavior: auto;
}


.checkout-panel main {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    padding: 1rem;
    padding-top: 0;
    overflow-y: hidden;
    flex-grow: 1;
}

.checkout-panel > main > * {
    flex: 1;
    overflow-y: auto;

}

.checkout-panel > .top-bar {
    grid-column: 1 / span 2;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: .5rem 1rem;
    gap: 2rem;
}

.checkout-panel > .top-bar > .back {
    cursor: pointer;
    padding: 1rem;
}

.checkout-panel > .top-bar > .back > svg {
    height: 1.5em;
    width: 1.5em;
    fill: var(--lightgrey);
}

.checkout-panel > .top-bar > h1 {
    text-overflow: ellipsis;
    overflow: hidden;
}

.checkout-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1rem;
}

.checkout-column .description {
    padding: 1rem;
    background-color: var(--grey2);
    border-radius: 1rem;
}

#app > .active {
    left: 0;
}

#app > :not(.active){
    pointer-events: none;
    user-select: none;
}

.main-panel > .menu-column {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
}

.main-panel > .product-column {
    flex: 1 0 16em;
    overflow-x: hidden;
}

.main-panel > .product-column > .category:last-of-type {
    min-height: 100%;
}

#session-info {
    height: 3.5rem;
    border-radius: 1rem;
    flex-grow: 1;
    text-align: center;
    display: block;
    background-color: var(--green);
    background-color: var(--grey1);
    overflow: hidden;
    gap: .5rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

#session-info.none {
    display: flex;
    background-color: var(--yellow);
    color: black;
}

#session-info.active {
    padding: 1rem;
    background-color: var(--green);
}

#session-info svg {
    margin: auto;
    width: 2rem;
    height: 2rem;
    fill: black;
}

.navigation {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    flex-grow: 1;
    justify-content: flex-end;
    align-items: stretch;
    align-content: stretch;
    position: relative;
    overflow-y: auto;
}

.navigation > a {
    color: var(--lightgrey);
    padding: 0.5em 0em .5em 2.5em;
    max-width: 16rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.navigation > div {
    transition: top .5s ease-out;
    width: 5px;
    background-color: var(--lightgrey);
    height: 0;
    position: absolute;
    left: 0;
    top: 0;
}

h1 {
    font-weight: 300;
    font-size: 1.5rem;
}

h2 {
    font-weight: 300;
    font-size: 1.125rem;
    margin-bottom: 1em;
}

.category {
    padding: 1rem;
}

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14em, 1fr));
    grid-gap: .5em;
}

.products > div {
    background-color: var(--grey1);
    border-radius: 1rem;
    padding: 1rem;
    cursor: pointer;
}

.products > div > div {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.products .note {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.products .price {
    white-space: nowrap;
}

h3 {
    font-weight: 400;
    font-size: 1rem;
}

.products > div > h3 {
    margin-bottom: .5em;
    height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.button-group {
    display: flex;
    width: 14rem;
    flex-direction: row;
    gap: 1rem;
    margin: 1rem;
}

.quick-payment {
    padding: 1rem;
    margin: 1rem;
    text-align: center;
    font-weight: 400;
}

.quick-payment, .statistics-button {
    background-color: var(--grey2);
    border-radius: 1rem;
    cursor: pointer;
    display: block;
}

.statistics-button {
    aspect-ratio: 1;
    width: 3.5rem;
    height: 3.5rem;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.statistics-button svg {
    width: 2rem;
    height: 2rem;
    fill: var(--lightgrey);
}

.offline-indicator {
    display: none;
    position: absolute;
    top: -.25rem;
    right: -.25rem;
    background: #fff;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
}

.offline-indicator.active {
    display: flex;
}

.offline-indicator svg {
    width: .85rem;
    height: .85rem;
    fill: var(--red);
}

.navigation > .marker {
    background-color: var(--lightgrey);
    height: 3.5em;
    width: 5px;
    position: absolute;
    top: 0px;
    left: 0;
}

.checkout-column h2 {
    font-size: 1.125rem;
}

.checkout-column > .options {
    display: grid;
    gap: .5rem;
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
}

.checkout-column h2 {
    margin-bottom: 0;
    margin-right: auto;
}

.checkout-column > .options > div {
    background-color: var(--grey1);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    user-select: none;
    flex-wrap: wrap;
    container-type: inline-size;
}

.row-header {
    display: flex;
    align-items: center;
    flex: 1;
}

@container (max-width: 340px) {
    .row-header {
        flex: 1 0 100%;
    }
}

.total-price {
    font-size: 1.125rem;
}


.row-price {
    font-size: 1.125rem;
    color: var(--lightgrey);
    white-space: nowrap;
}

.quantity-button {
    font-size: 1.5rem;
    cursor: pointer;
    padding: .5rem;
    border-radius: .5rem;
    width: 2em;
    height: 2em;
    display: flex;
    justify-content: center;
    align-items: center;
}


.tab-column {
    display: flex;
    background-color: var(--grey1);
    border-radius: 1rem;
    margin-right: 0;
    flex-direction: column;
    overflow: hidden;
}

.tab-column-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-radius: 1rem;
    flex-shrink: 0;
}

.tab-column-header h2 {
    margin: 0;
    padding: 0;
}

.icon-button {
    background: none;
    border: none;
    padding: .4rem;
    border-radius: .5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--grey3);
    transition: color .15s, background-color .15s;
}


.icon-button svg {
    width: 1.5rem;
    height: 1.5rem;
}

.icon-button.active {
    color: var(--lightgrey);
}

.multi-tab-active-label {
    opacity: 0;
    font-size: .85rem;
    font-weight: 400;
    margin-right: 1em;
    transition: opacity .15s;
}

.icon-button.active .multi-tab-active-label {
    display: inline;
    opacity: 1;
}

.tab-list {
    padding-left: 1rem;
    padding-right: 1rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

.tab-list h3 {
    margin-bottom: .5rem;
}

.alphabet-container {
    min-height: 100%;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
}

#session-tab-list .alphabet-container {
    min-height: min(80vh, 35rem); /* 100% breaks MobileSafari  */
}

.alphabet {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(10, 1fr);
    margin-bottom: 1rem;
}


.alphabet-container h3 {
    margin-top: auto;
}

.alphabet > div {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    padding: .5rem;
    border-radius: .5rem;
}

.alphabet > div:hover {
    background-color: var(--grey2);
}

.alphabet > div.disabled {
    background-color: transparent;
    cursor: default;
    color: var(--grey2);
}

.tab-list {
    display: flex;
    flex-direction: column;
}

.tabs, .tab-list .suggestions {
    display: grid;
    flex-direction: column;
    gap: .5rem;
    padding: 0;
    grid-template-columns: 1fr 1fr;
    padding-bottom: 1rem;
}

.tabs > div, .tab-list .suggestions > div {
    padding: 1rem;
    border-radius: .5rem;
    background-color: var(--grey2);
    margin: 0;
    cursor: pointer;
    user-select: none;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    transition: background-color .2s, color .2s;
}

.tabs > div.blink {
    background-color: var(--grey3);
}

.tabs > div.host-only, .tab-list .suggestions > div.host-only {
    opacity: 0.5;
}

.products > div.selected, .quick-payment.selected {
    transition: background-color .2s, color .2s;
    background-color: var(--lightgrey);
    color: #000;
}

.tabs > div.selected, .tab-list .suggestions > div.selected {
    background-color: var(--lightgrey);
    color: #000;
}

#price-choice {
    border-radius: .5rem;
    width: 300px;
    background-color: var(--grey2);
    white-space: nowrap;
}

#single-price {
    font-size: 1.125rem;
}

.radio-custom {
  box-sizing: border-box;
  display: block;
  border-radius: .5rem;
  float: left;
  font-weight: 200;
  width: 50%;
  text-align: center;
  text-transform: initial;
  padding: .5em 1em;
  transition: background-color 0.2s, color 0.2s;
}
.radio-custom:first-of-type {
  margin-left: 0;
}
.radio-custom:hover {
  cursor: pointer;
}

input[type=radio] {
  display: none;
}

input[type=radio]:checked + label {
  background-color: var(--lightgrey);
  color: #000;
}

.confirmation {
    margin-top: auto;
    border-radius: 1rem;
    font-size: 1.125rem;
    align-self: last baseline;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    white-space: nowrap;
    margin-left: auto;
    background-color: var(--grey1);
    max-width: 100%;
}

.confirmation .summary {
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.confirmation .summary > div:first-of-type {
    margin-left: 1rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.confirmation .summary > div {
    margin-right: 1rem;
}

.button {
    position: relative;
    padding: 1rem 2rem;
    font-size: 1rem;
    background-color: var(--lightgrey);
    color: #000;
    border-radius: 1rem;
    user-select: none;
    cursor: pointer;
}

.confirmation > .button.disabled, .button.disabled {
    background-color: var(--grey2);
    color: var(--grey3);
    cursor: default;
}

.slider-container {
    width: 100%;
    position: relative;
}

.slider-container > span {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* The slider itself */
.slider {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 4rem;
    padding: .5rem;
    background: #d3d3d3;
    outline: none;
    border-radius: 1rem;
    background-color: var(--grey1);
    pointer-events: none;
  }

  .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
  }

  .slider::-webkit-slider-thumb, .slider::-moz-range-thumb {
    width: 3rem;
    height: 3rem;
    background: var(--lightgrey);
    cursor: pointer;
    border-radius: .5rem;
    border: none;
    pointer-events: all;
    /* Use an inline svg as the thumb */
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -960 960 960"><path fill="%23ffffff" d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"/></svg>') no-repeat center var(--grey2);
  }

.confirmation .accepted {
    background-color: var(--green);
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    transition: opacity .2s;
    color: white;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 1rem;
}

.confirmation.ok .accepted {
    opacity: 1;
}

/* "Syötä PIN" prompt overlaid on the button while the keypad is open, so the
   button keeps the width defined by its "Lisää piikkiin" label */
.confirmation .pin-prompt {
    background-color: var(--grey2);
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    color: var(--grey3);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 1rem;
}

.confirmation.pin-mode .pin-prompt {
    opacity: 1;
}

.confirmation.ok .button {
    background-color: var(--green);
    color: var(--green);
    transition: background-color .2s, color .2s;
}

/* ---- PIN pad ---- */

/* Hidden in normal mode; shown only when #confirmation has .pin-mode */
.confirmation:not(.pin-mode) #pinpad {
    display: none;
}

/* In pin-mode the summary + button keep their original row and position.
   The keypad is taken out of flow and floats directly above the pill, so it
   shifts nothing and adds no visible container around the summary/button.

   It is fixed (not absolute) so it escapes the overflow clipping of the
   checkout columns and `main`, and a z-index keeps it above the tab list and
   page content.
   Its left/bottom are anchored to the confirm button from JS. */
.confirmation.pin-mode #pinpad {
    position: fixed;
    z-index: 100;
}

/* The keypad: a flat card in a different background shade, floating just
   above the button bar with a slight gap. */
.pin-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    user-select: none;
    background-color: var(--grey1);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 0 5px 0 var(--background);
}

/* Row of six dots showing entry progress */
.pin-dots {
    display: flex;
    flex-direction: row;
    gap: .75rem;
    align-items: center;
    justify-content: center;
}

.pin-dot {
    width: .85rem;
    height: .85rem;
    border-radius: 50%;
    border: 2px solid var(--grey3);
    background-color: transparent;
    box-sizing: border-box;
    transition: background-color .1s, border-color .1s;
}

.pin-dot.filled {
    background-color: var(--lightgrey);
    border-color: var(--lightgrey);
}

/* Remaining-attempts / error text */
.pin-attempts {
    color: var(--red);
    font-size: .9rem;
    text-align: center;
    min-height: 1.2em;
}

.pin-attempts:empty {
    display: none;
}

/* 3-column keypad grid */
.pin-keys {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: .75rem;
    justify-content: center;
}

.pin-key {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border: none;
    background-color: var(--grey2);
    color: var(--lightgrey);
    cursor: pointer;
    user-select: none;
    transition: background-color .1s, transform .05s;
}

/* Correction / backspace and cancel keys: flat, no well */
.pin-key.backspace,
.pin-key.cancel {
    background-color: transparent;
    color: var(--lightgrey);
    font-size: 1.25rem;
}

.pin-key.backspace:hover,
.pin-key.cancel:hover {
    background-color: var(--grey2);
}

/* Locked-out message; hidden unless JS sets text content */
.pin-locked {
    display: none;
    color: var(--red);
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
    white-space: normal;
    max-width: 10em;
}

.pin-locked.active {
    display: block;
}

/* When locked, the dots and attempt counter are irrelevant — only show the
   locked message (and the keypad, which is inert apart from cancel). */
.pin-card.locked .pin-dots,
.pin-card.locked .pin-attempts {
    display: none;
}

.login-panel {
    display: none;
}

.login-panel.active {
    display: flex;
    background: rgba(16,16,16,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 1.5rem;
    animation: fadeIn .2s;
}

/* Full-screen blur shown after "Päivitä" is clicked, covering the reload
   gap while the new service worker takes over and the page reloads. */
.update-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(16,16,16,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    animation: fadeIn .2s;
}

.update-overlay.active {
    display: flex;
}

.update-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--grey3);
    border-top-color: var(--lightgrey);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.login-card {
    width: 100%;
    max-width: 22rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    background: var(--grey1);
    border: 1px solid var(--grey3);
    border-radius: 1.5rem;
    padding: 2rem 1.75rem;
    box-shadow: 0 1.5rem 3rem rgba(0,0,0,0.45);
}

.login-logo {
    align-self: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 1.25rem;
}

.login-title {
    text-align: center;
    font-weight: 600;
    font-size: 1.6rem;
    margin: 0;
}

.login-subtitle {
    text-align: center;
    color: var(--lightgrey);
    opacity: .65;
    font-size: .95rem;
    margin-top: -.5rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    text-align: left;
}

.login-field > span {
    font-size: .85rem;
    color: var(--lightgrey);
    opacity: .8;
    padding-left: .25rem;
}

.login-field input {
    width: 100%;
    text-align: left;
    font-size: 1.15rem;
    padding: 0 .85rem;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    color: var(--lightgrey);
    cursor: pointer;
    user-select: none;
}

.login-remember input {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    accent-color: var(--green);
    cursor: pointer;
}

.login-card .button {
    margin-top: .25rem;
    width: 100%;
    text-align: center;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
}

.login-card .button:disabled {
    background-color: var(--grey2);
    color: var(--grey3);
    cursor: default;
}

.session-panel {
    display: none;
}

.session-panel.active {
    display: flex;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn .2s;
}

.session-window {
    transition: opacity .2s;
}

.session-panel .session-window {
    opacity: 1;
}

.session-panel.opening .session-window {
    opacity: 0;
}

.session-panel.closing {
    animation: fadeOut .2s;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.session-window {
    width: min(calc(100% - 2rem), 30rem);
    padding: 1rem;
    background-color: var(--grey1);
    border-radius: 1rem;
    display: block;
}

.session-window .button {
    width: 100%;
    margin-top: 1rem;
    text-align: center;
    transition: background-color .2s;
}

.session-window .button.ok {
    background-color: var(--green);
    color: white;
}


.session-selection {
    display: flex;
    flex-direction: column;
    max-height: min(80vh, 35rem);
}

.session-window .tab-list {
    overflow-y: auto;
    height: 80rem;
}

.session-window .tab-list h3, .session-window .tab-list .suggestions {
    display: none;
}

.session-window .buttons {
    width: 100%;
    display: flex;
    gap: 1rem;
}

.session-details p {
    font-size: 1.125rem;
    margin-bottom: .5rem;
}

.session-details p > span {
    font-weight: 400;
}

.button.close {
    width: 10rem;
    background-color: var(--grey2);
    color: white;
}

.session-panel .alphabet {
    grid-template-columns: repeat(6, 1fr);
}

/* Statistics Panel */
.statistics-panel {
    display: none;
}

.statistics-panel.active {
    display: flex;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn .2s;
    z-index: 50;
}

.statistics-panel.opening .statistics-window {
    opacity: 0;
}

.statistics-panel.closing {
    animation: fadeOut .2s;
    opacity: 0;
}

.statistics-window {
    width: min(calc(100% - 2rem), 30rem);
    max-height: min(80vh, 40rem);
    padding: 1rem;
    background-color: var(--grey1);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    transition: opacity .2s;
    position: relative;
}

.statistics-window h2 {
    margin-bottom: 1rem;
}

.statistics-window h3 {
    margin: 1rem 0 .5rem 0;
}

.statistics-window p {
    font-size: 1.125rem;
    margin-bottom: .25rem;
}

.statistics-window p > span {
    font-weight: 400;
}

.statistics-list-view,
.statistics-detail-view {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.statistics-list-content {
    overflow-y: auto;
    flex: 1;
    padding-right: .5rem;
}

.statistics-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}

.statistics-tabs > h2 {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.statistics-tabs > div {
    padding: 1rem;
    border-radius: .5rem;
    background-color: var(--grey2);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    transition: background-color .2s;
}

.statistics-tabs > div .tab-name {
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.statistics-tabs > div .tab-balance {
    font-size: 0.875rem;
    color: var(--lightgrey);
}

.statistics-tabs > div .tab-balance.negative {
    color: var(--red);
}

.statistics-tabs > div .tab-balance.positive {
    color: var(--green);
}

.statistics-tabs > div.inactive {
    opacity: 0.5;
}

.statistics-tabs > div.selected {
    background-color: var(--lightgrey);
    color: #000;
}

.statistics-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.statistics-detail-header .back {
    cursor: pointer;
    padding: .5rem;
    margin: -.5rem;
}

.statistics-detail-header .back svg {
    fill: var(--lightgrey);
    display: block;
}

.statistics-detail-header h2 {
    margin: 0;
}

.statistics-purchases {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    overflow-y: auto;
    flex: 1;
    padding-right: .5rem;
}

.statistics-purchases > div {
    padding: .75rem 1rem;
    border-radius: .5rem;
    background-color: var(--grey2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.statistics-purchases > div .purchase-info {
    display: flex;
    flex-direction: column;
    gap: .125rem;
}

.statistics-purchases > div .purchase-product {
    font-weight: 400;
}

.statistics-purchases > div .purchase-date {
    font-size: 0.75rem;
    color: var(--lightgrey);
}

.statistics-purchases > div .purchase-total {
    font-weight: 400;
    white-space: nowrap;
}

.statistics-purchases .no-purchases {
    color: var(--lightgrey);
    text-align: center;
    padding: 1rem;
}

.statistics-window .buttons {
    margin-top: 1rem;
}

.statistics-window .button {
    width: 100%;
    text-align: center;
}

.statistics-status .active-status {
    color: var(--green);
}

.statistics-status .inactive-status {
    color: var(--red);
}

/* ---- PIN-required toggle (statistics detail) ---- */

.pin-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0 .25rem;
    font-size: 1.125rem;
}

.pin-info-note {
    font-size: .8rem;
    color: var(--lightgrey);
    margin-bottom: .25rem;
}

.pin-lockout-note {
    font-size: .8rem;
    color: var(--lightgrey);
    margin-bottom: .25rem;
}

/* iOS-style toggle switch */
.ios-toggle {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
}

.ios-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-toggle-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background-color: var(--grey3);
    border-radius: 31px;
    transition: background-color .2s;
}

.ios-toggle-slider::before {
    content: "";
    position: absolute;
    height: 27px;
    width: 27px;
    left: 2px;
    top: 2px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
    transition: transform .2s;
}

.ios-toggle input:checked + .ios-toggle-slider {
    background-color: var(--green);
}

.ios-toggle input:checked + .ios-toggle-slider::before {
    transform: translateX(20px);
}

/* Overlay that floats the PIN keypad over the whole statistics window while
   confirming a toggle change. */
.statistics-pin-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, .5);
    border-radius: 1rem;
    justify-content: center;
    align-items: center;
}

.statistics-pin-overlay.active {
    display: flex;
}

footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--grey3);
    padding: 2rem;
}

@media screen and (max-width: 999px) {
    .checkout-panel .alphabet {
        grid-template-columns: repeat(6, 1fr);
    }

    #price-choice {
        width: auto;
    }

    .radio-custom {
        width: auto;
    }
}

/* ---- Offline mode ---- */

.offline-queue-section {
    background-color: #2d1111;
    border-radius: .75rem;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
}

.offline-queue-section h3 {
    margin: 0 0 .25rem;
    font-size: 1rem;
    font-weight: 400;
}

.offline-queue-section .offline-explanation {
    font-size: .8rem;
    color: var(--lightgrey);
    opacity: .7;
    margin-bottom: .5rem;
}

.offline-queue-section .offline-last-update {
    font-size: .8rem;
    color: var(--lightgrey);
    opacity: .7;
    margin-bottom: .25rem;
}

.offline-queue-section .offline-queue-count {
    font-size: .875rem;
    margin-bottom: .25rem;
}

.offline-queue-section .offline-queue-count:empty {
    display: none;
}

.offline-queue-section #offline-sync {
    margin-top: .5rem;
    text-align: center;
    padding: .5rem;
    border-radius: .5rem;
    cursor: pointer;
    font-size: .875rem;
}

.offline-queue-section #offline-sync.disabled {
    background-color: #3d1a1a;
    color: var(--grey3);
    pointer-events: none;
}

.offline-queue-list {
    flex: 1;
    overflow-y: auto;
}

.offline-queue-list:not(:empty) {
    margin-top: .25rem;
}

.offline-queue-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .5rem;
    padding: .5rem;
    border-radius: .5rem;
    background-color: #3d1a1a;
    margin-bottom: .25rem;
    font-size: .875rem;
}

.offline-queue-item.failed {
    border-left: 3px solid var(--red);
    background-color: #451515;
}

.offline-item-desc {
    flex: 1;
    min-width: 0;
}

.offline-item-error {
    color: var(--red);
    font-size: .75rem;
    width: 100%;
}

.offline-item-dismiss {
    background: none;
    border: none;
    color: var(--lightgrey);
    font-size: 1rem;
    cursor: pointer;
    padding: .25rem;
    flex-shrink: 0;
}


/* ---- Toasts (unified notification system, see toast.js) ---- */

.toast-container {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100vw - 2rem), 26rem);
    display: flex;
    flex-direction: column;
    gap: .625rem;
    z-index: 300;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .875rem 1rem;
    background: var(--grey2);
    color: var(--lightgrey);
    border: 1px solid var(--grey3);
    border-radius: .75rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .45);
    font-size: .9375rem;
    line-height: 1.35;
    overflow: hidden;
    animation: toastIn .32s cubic-bezier(.21, 1.02, .73, 1) both;
}

.toast--leaving {
    animation: toastOut .25s ease forwards;
}


.toast__icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast__icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.toast--success .toast__icon svg { fill: var(--green); }
.toast--update  .toast__icon svg { fill: var(--yellow); }
.toast--error   .toast__icon svg { fill: var(--red); }
.toast--info    .toast__icon svg { fill: var(--lightgrey); }

.toast__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: .1875rem;
    background: var(--grey3);
    transform-origin: left;
    animation-name: toastProgress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.toast__message {
    flex: 1;
    min-width: 0;
}

.toast__actions {
    flex-shrink: 0;
    display: flex;
    gap: .5rem;
}

.toast__action {
    background: var(--grey3);
    border: none;
    color: var(--lightgrey);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    padding: .4rem .85rem;
    border-radius: .5rem;
    white-space: nowrap;
    transition: filter .15s, background-color .15s;
}

.toast__action:hover { filter: brightness(1.15); }
.toast__action:active { filter: brightness(.9); }

.toast__action--primary {
    background: var(--green);
    color: #fff;
}

.toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: .25rem;
    margin: -.25rem -.25rem -.25rem 0;
    display: flex;
    align-items: center;
    opacity: .6;
    transition: opacity .15s;
}

.toast__close:hover { opacity: 1; }

.toast__close svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: var(--lightgrey);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(1rem) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(.5rem) scale(.96); }
}

@keyframes toastProgress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
    .toast { animation: fadeIn .2s both; }
    .toast--leaving { animation: fadeOut .2s forwards; }
    .toast__progress { animation: none; opacity: 0; }
}

@media screen and (max-width: 759px) {
    /* Make navigation more compact */
    .navigation > a {
        padding: .5em 0em .5em 1.5em;
        max-width: 10rem;
    }

    .button-group {
        flex-direction: column;
        width: auto;
    }

    .statistics-button {
        width: auto;
        aspect-ratio: unset;
    }


    .main-panel > .menu-column {
        flex: 0 0 auto;
    }

    .alphabet {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .alphabet > div {
        width: 3rem;
    }

    .checkout-panel main {
        display: block;
        overflow-y: auto;
    }

    .tab-column {
        height: 20rem;
        margin-bottom: 1rem;
    }

}


@media screen and (max-width: 669px) {
    .main-panel {
        display: block;
        overflow-y: auto;
    }

    .navigation > a {
        max-width: none;
        text-align: center;
        padding: .5em 1em;
    }

    .navigation .marker {
        display: none;
    }

    .statistics-tabs {
        grid-template-columns: 1fr;
    }
}
