/* The back office's own look, on top of the shared autobonus.css (its colours are set there). */

/* The menu down the side, dark with inks of its own (MainLayout, NavMenu). */
:root {
    --ab-side: #12263a;
    --ab-side-ink: #e8edf2;
    --ab-side-bright: #ffffff;
    --ab-side-link: #c9d6e2;
    --ab-side-muted: #9fb3c8;
}

/* --- Home --------------------------------------------------------------------------------- */

.home-lead {
    margin: -0.5rem 0 0;
    color: var(--ab-muted);
}

/* Three across at most, so six areas make two full rows rather than five and one. */
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
    gap: 1rem;
    max-width: 62rem;
    margin-top: 1.75rem;
}

.home-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.25rem 0.875rem;
    padding: 1.125rem 1.125rem 1.125rem 1rem;
    border-radius: var(--ab-panel-radius);
}

.home-card-icon {
    display: inline-flex;
    grid-row: span 2;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.625rem;
    background: var(--ab-brand-tint);
    color: var(--ab-brand);
    transition: background-color var(--ab-fast) ease, color var(--ab-fast) ease;
}

.home-card:hover .home-card-icon {
    background: var(--ab-brand);
    color: var(--ab-brand-ink);
}

.home-card-title {
    font-family: var(--ab-font-display);
    font-size: 1.1875rem;
    font-weight: 600;
    line-height: 1.2;
}

.home-card-text {
    grid-column: 2;
    color: var(--ab-muted);
    font-size: 0.875rem;
}

.home-card-go {
    grid-row: 1 / span 2;
    grid-column: 3;
    color: var(--ab-border-strong);
    transition: color var(--ab-fast) ease, transform var(--ab-slow) var(--ab-ease);
}

.home-card:hover .home-card-go {
    color: var(--ab-brand);
    transform: translateX(3px);
}

/* --- Lists -------------------------------------------------------------------------------- */

/* A list's title with what is done to the list as a whole beside it (export, add). */
.list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.list-head .page-title {
    margin-bottom: 0;
}

.list-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.list-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
}

/* A filter's buttons scroll sideways on a phone rather than leave the page. */
.list-tools > .btn-group {
    max-width: 100%;
    overflow-x: auto;
}

.list-tools > .btn-group > .btn {
    white-space: nowrap;
}

/* An export above a list: its days and kinds in a row, wrapping on a narrow window. */
.export-panel {
    margin-bottom: 1.25rem;
}

.export-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
}

.export-fields fieldset {
    margin: 0;
}

/* The points report: its title and months on one line, wrapping on a narrow window. */
.report-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.report-table th,
.report-table td:first-child {
    white-space: nowrap;
}

.list-search {
    position: relative;
    flex: 1 1 18rem;
    max-width: 30rem;
}

.list-search > svg {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    color: var(--ab-muted);
    pointer-events: none;
}

.list-search > input {
    padding-left: 2.25rem;
}

.list-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
    color: var(--ab-muted);
    font-size: 0.875rem;
}

/* A table in its box: the box's corners, its headings small on a band, and sideways scrolling on a
   screen narrower than the table rather than columns cut off. FreeTable's stylesheet loads after
   this one and hides the overflow, so the element is named to outweigh it. */
div.ft-box {
    /* Positioned, so a heading's visually-hidden words (absolute) scroll with the table instead of
       widening the page. */
    position: relative;
    overflow-x: auto;
    box-shadow: var(--ab-shadow-sm);
}

.ft-box > .table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--ab-brand-tint);
    --bs-table-active-bg: color-mix(in srgb, var(--ab-brand) 12%, white);
    margin-bottom: 0;
}

.ft-box > .table > :not(caption) > * > * {
    padding-top: 0.6875rem;
    padding-bottom: 0.6875rem;
    border-bottom-color: var(--ab-border);
}

.ft-box > .table-sm > :not(caption) > * > * {
    padding-top: 0.4375rem;
    padding-bottom: 0.4375rem;
}

.ft-box > .table > * > tr > :first-child {
    padding-left: 1rem;
}

.ft-box > .table > * > tr > :last-child {
    padding-right: 1rem;
}

.ft-box > .table > thead > tr > th {
    background: var(--ab-surface-sunk);
    color: var(--ab-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ft-box > .table > thead > tr > th.th-sort:hover {
    color: var(--ab-ink);
}

.ft-box > .table > tbody > tr:last-child > * {
    border-bottom-width: 0;
}

.ft-box > .table > tfoot > tr > * {
    border-top: 1px solid var(--ab-border);
    border-bottom-width: 0;
}

tr.row-link {
    cursor: pointer;
}

tr.row-link > td {
    transition: background-color var(--ab-fast) ease;
}

tr.row-link a {
    font-weight: 600;
    text-decoration: none;
}

tr.row-link:hover a {
    text-decoration: underline;
}

tr.is-inactive td {
    color: var(--ab-muted);
}

/* The rows a list shows while it reads. */
.skeleton-row td {
    padding-top: 0.9375rem !important;
    padding-bottom: 0.9375rem !important;
}

/* --- One record's page: a member, an order, a product, a person --------------------------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.page-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    color: var(--ab-muted);
}

.head-figure {
    text-align: right;
}

.head-figure-number {
    color: var(--ab-brand);
    font-family: var(--ab-font-display);
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1;
}

.head-figure-label {
    margin-top: 0.25rem;
    color: var(--ab-muted);
    font-size: 0.875rem;
}

.page-columns {
    display: grid;
    grid-template-columns: minmax(18rem, 2fr) 3fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .page-columns {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* The wider column first, for a first panel of long values (the e-mail settings' addresses). */
@media (min-width: 992px) {
    .page-columns.is-first-wide {
        grid-template-columns: 3fr minmax(18rem, 2fr);
    }
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.875rem;
}

.confirm-strip {
    max-width: 48rem;
}

.confirm-strip-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.panel-stack {
    display: grid;
    gap: 1.25rem;
    align-content: start;
}

.facts {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.625rem 1rem;
    margin: 0;
}

.facts dt {
    color: var(--ab-muted);
    font-weight: 400;
}

.facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    .facts {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .facts dt {
        font-size: 0.8125rem;
    }

    .facts dd {
        margin-bottom: 0.625rem;
    }

    .head-figure {
        text-align: left;
    }
}

/* A change's history: who and when above what changed, a hairline between. */
.change-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.change-list > li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--ab-border);
}

.change-list > li:first-child {
    padding-top: 0;
}

.change-list > li:last-child {
    border-bottom: 0;
}

/* --- Points imports ----------------------------------------------------------------------- */

.import-intro {
    max-width: 46rem;
    color: var(--ab-muted);
}

/* The two meanings of a file as two cards to choose between. */
.import-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 0.75rem;
    max-width: 46rem;
    margin: 0 0 1.25rem;
    padding: 0;
    border: 0;
}

.import-mode {
    display: flex;
    gap: 0.75rem;
    margin: 0;
    padding: 0.875rem 1rem;
    border: 1px solid var(--ab-border-strong);
    border-radius: 0.625rem;
    background: var(--ab-surface);
    cursor: pointer;
    transition: border-color var(--ab-fast) ease, background-color var(--ab-fast) ease, box-shadow var(--ab-fast) ease;
}

.import-mode:hover {
    border-color: color-mix(in srgb, var(--ab-brand) 45%, var(--ab-border-strong));
}

.import-mode:has(input:checked) {
    border-color: var(--ab-brand);
    background: var(--ab-brand-tint);
    box-shadow: 0 0 0 1px var(--ab-brand);
}

.import-mode .form-check-input {
    flex-shrink: 0;
    margin: 0.2rem 0 0;
}

.import-mode-name {
    display: block;
    font-weight: 600;
}

.import-mode-text {
    display: block;
    color: var(--ab-muted);
    font-size: 0.875rem;
}

.import-file {
    max-width: 32rem;
    margin-bottom: 1rem;
}

/* What a file would do, in figures: one tile each. */
.import-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}

.import-stat {
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--ab-border);
    border-radius: 0.625rem;
    background: var(--ab-surface-sunk);
}

.import-stat-figure {
    font-family: var(--ab-font-display);
    font-size: 1.625rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.import-stat-figure.is-plus {
    color: var(--ab-plus);
}

.import-stat-figure.is-minus {
    color: var(--ab-minus);
}

.import-stat-label {
    overflow-wrap: anywhere;
    color: var(--ab-muted);
    font-size: 0.8125rem;
}

/* A whole membership is ~2,100 rows: the table scrolls inside the page, its header kept. Named
   with ft-box to outweigh FreeTable's hidden overflow. */
.ft-box.import-rows {
    max-height: 32rem;
    overflow: auto;
}

.import-rows thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.import-rows tr.is-problem td {
    background: color-mix(in srgb, var(--ab-minus) 8%, var(--ab-surface));
}

.import-rows tr.is-unchanged td {
    color: var(--ab-muted);
}

.import-problem {
    color: var(--ab-minus);
    font-size: 0.8125rem;
}

/* The imports' columns keep their widths on a laptop's screen: a long reason is cut short, never
   the Undo beside it. On a phone the table scrolls sideways at a width that holds them. */
.import-history {
    min-width: 46rem;
    table-layout: fixed;
}

.import-note {
    max-width: 100%;
    overflow: hidden;
    color: var(--ab-muted);
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-undo {
    margin-top: 1.25rem;
    padding: 1.125rem 1.25rem;
    border: 1px solid color-mix(in srgb, var(--bs-warning) 55%, var(--ab-border));
    border-radius: 0.625rem;
    background: color-mix(in srgb, var(--bs-warning) 7%, var(--ab-surface));
}

/* --- Changing a member -------------------------------------------------------------------- */

.member-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
    gap: 1.25rem;
    align-items: start;
}

.member-no-input {
    max-width: 16rem;
}

/* Add points or take them away: the two halves of one switch. */
.adjust-direction {
    display: inline-flex;
    margin-bottom: 1rem;
    padding: 0.1875rem;
    border-radius: 0.625rem;
    background: var(--ab-surface-sunk);
    box-shadow: inset 0 0 0 1px var(--ab-border);
}

.adjust-direction > .btn {
    --bs-btn-border-width: 0;
    border-radius: 0.5rem !important;
}

.adjust-direction > .btn-check:not(:checked) + .btn {
    background: transparent;
    color: var(--ab-muted);
}

.adjust-direction > .btn-check:checked + .btn {
    background: var(--ab-surface);
    box-shadow: var(--ab-shadow-sm), 0 0 0 1px var(--ab-border);
    color: var(--ab-ink);
}

.adjust-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
    margin-top: 1rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    background: var(--ab-surface-sunk);
}

.adjust-preview strong {
    font-family: var(--ab-font-display);
    font-size: 1.25rem;
}

.temp-password {
    max-width: 48rem;
}

.temp-password-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.temp-password-text {
    padding: 0.375rem 0.875rem;
    border: 1px dashed color-mix(in srgb, var(--ab-plus) 50%, var(--ab-border));
    border-radius: 0.5rem;
    background: var(--ab-surface);
    color: var(--ab-ink);
    font-size: 1.375rem;
    letter-spacing: 0.08em;
    user-select: all;
}

/* --- Catalogue ---------------------------------------------------------------------------- */

.sub-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--ab-border);
}

/* NavLink's own anchors: this file is global, so no ::deep is needed here. */
.sub-tab {
    margin-bottom: -1px;
    padding: 0.5rem 0.875rem 0.625rem;
    border-bottom: 2px solid transparent;
    color: var(--ab-muted);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--ab-fast) ease, border-color var(--ab-fast) ease;
}

.sub-tab:hover {
    border-bottom-color: var(--ab-border-strong);
    color: var(--ab-ink);
}

.sub-tab.active {
    border-bottom-color: var(--ab-brand);
    color: var(--ab-ink);
    font-weight: 600;
}

.list-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--ab-border);
    border-radius: 0.5rem;
    background: var(--ab-picture);
    object-fit: contain;
}

.list-thumb-empty {
    color: var(--ab-border-strong);
}

.product-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18.5rem;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .product-editor {
        grid-template-columns: minmax(0, 1fr);
    }
}

.product-main,
.product-side {
    display: grid;
    gap: 1.25rem;
}

/* The save button stays in reach beside a long form. */
.product-side {
    position: sticky;
    top: 1rem;
}

@media (max-width: 991.98px) {
    .product-side {
        position: static;
    }
}

.product-description-input {
    font-family: var(--bs-font-monospace);
    font-size: 0.875rem;
}

.product-sort-input {
    max-width: 8rem;
}

.choice-list {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 0.875rem;
    padding: 0;
    list-style: none;
}

.choice-row {
    padding: 0.875rem;
    border: 1px solid var(--ab-border);
    border-radius: 0.625rem;
    background: var(--ab-surface-sunk);
}

.choice-fields {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.625rem;
}

@media (max-width: 575.98px) {
    .choice-fields {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .choice-fields > :first-child {
        grid-column: 1 / -1;
    }
}

.choice-stock {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    margin-top: 0.625rem;
}

.choice-quantity {
    width: 7rem;
}

.choice-moves {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.picture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
    gap: 0.875rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.picture-tile {
    padding: 0.5rem;
    border: 1px solid var(--ab-border);
    border-radius: 0.625rem;
    background: var(--ab-surface);
    transition: box-shadow var(--ab-fast) ease;
}

.picture-tile:hover {
    box-shadow: var(--ab-shadow-md);
}

.picture-tile-image {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.375rem;
}

.picture-first {
    position: absolute;
    top: 0.375rem;
    left: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--ab-brand);
    color: var(--ab-brand-ink);
    font-size: 0.75rem;
    font-weight: 600;
}

.picture-tile-tools {
    display: flex;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.picture-upload {
    max-width: 32rem;
}

/* --- A list beside its form: shelves, couriers, roles (ListAndFormPage) ------------------- */

.list-and-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .list-and-form {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* The form beside the list: what is being changed, at the list's height on a wide screen. */
.list-and-form > .panel:last-child {
    position: sticky;
    top: 1rem;
}

@media (max-width: 991.98px) {
    .list-and-form > .panel:last-child {
        position: static;
    }
}

.pick-list {
    display: grid;
    gap: 0.125rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pick-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5625rem 0.75rem;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: var(--ab-ink);
    text-align: left;
    transition: background-color var(--ab-fast) ease;
}

.pick-row:hover {
    background: var(--ab-surface-sunk);
}

.pick-row.active {
    background: var(--ab-brand-tint);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ab-brand) 30%, transparent);
    font-weight: 600;
}

.pick-row.is-inactive {
    color: var(--ab-muted);
}

.pick-count {
    margin-left: auto;
    color: var(--ab-muted);
    font-size: 0.8125rem;
    font-weight: 400;
    white-space: nowrap;
}

/* The form's empty state, before anything is chosen. */
.pick-hint {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    color: var(--ab-muted);
}

.pick-hint > svg {
    flex-shrink: 0;
    color: var(--ab-border-strong);
}

/* --- Orders ------------------------------------------------------------------------------- */

.order-action {
    max-width: 48rem;
    margin-bottom: 1.25rem;
}

.order-lines td {
    vertical-align: middle;
}

.order-notes {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

/* The history as a line down the side, a dot for each note. */
.order-notes li {
    position: relative;
    padding: 0 0 1rem 1.375rem;
}

.order-notes li::before {
    content: "";
    position: absolute;
    top: 0.375rem;
    left: 0.125rem;
    width: 0.5625rem;
    height: 0.5625rem;
    border: 2px solid var(--ab-brand);
    border-radius: 50%;
    background: var(--ab-surface);
}

.order-notes li:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1.0625rem;
    bottom: 0.125rem;
    left: 0.375rem;
    width: 1px;
    background: var(--ab-border);
}

.order-notes li.is-for-member::before {
    border-color: var(--ab-accent);
    background: var(--ab-accent);
}

.order-note-body {
    white-space: pre-line;
}

.order-note-form {
    max-width: 48rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ab-border);
}

/* --- Staff -------------------------------------------------------------------------------- */

.staff-form {
    max-width: 36rem;
}

.role-group {
    margin: 0 0 1.25rem;
    padding: 0;
    border: 0;
}

.role-group legend {
    margin-bottom: 0.5rem;
    color: var(--ab-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.role-group .form-check {
    margin-bottom: 0.625rem;
}

/* --- E-mails ------------------------------------------------------------------------------ */

.email-preview {
    width: 100%;
    height: 36rem;
    margin-top: 0.875rem;
    border: 1px solid var(--ab-border);
    border-radius: 0.625rem;
    background: var(--ab-surface);
}

.email-error {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-emails {
    margin: 0 0 0.5rem;
    padding: 0;
    list-style: none;
}

.order-emails li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--ab-border);
}

.order-emails li:first-child {
    padding-top: 0;
}

.order-emails li:last-child {
    border-bottom: 0;
}

/* --- A phone ------------------------------------------------------------------------------ */

@media (max-width: 575.98px) {
    .page-title {
        font-size: 1.5rem;
    }

    .head-figure-number {
        font-size: 2rem;
    }

    .list-search {
        max-width: none;
    }

    /* The finishing buttons across the width, the main one on top. */
    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}
