/* The platform administration: a back office, and it looks like one.
 *
 * The product is a bright, friendly application a club treasurer uses a
 * few evenings a month. This is not that. This is the desk the service is
 * run from — a ledger, an account statement, a stack of invoices — and it
 * is built out of that world: ink for the rail, paper for the surface,
 * hairlines instead of cards, and one deep petrol that marks everything
 * that can be acted on.
 *
 * The one rule the whole thing hangs on: **identifiers are machine, names
 * are human.** Every slug, invoice number, IBAN, reference and amount is
 * set in the monospace face with tabular figures; every name, title and
 * sentence is set in the sans. It is the reason a column of numbers here
 * lines up and a column of names does not have to.
 *
 * Loaded on top of Tabler (conjunto/base.html brings it), so selectors are
 * prefixed `bo-` and specific enough to win without !important.
 */

.bo {
    --bo-ink: #14161d;
    --bo-ink-soft: #262a35;
    --bo-paper: #f5f4f1;
    --bo-surface: #ffffff;
    --bo-rule: #e2dfd9;
    --bo-rule-strong: #cbc7bf;
    --bo-text: #22252d;
    --bo-muted: #6d7280;

    /* The accent. A darkened relative of the bookkeeping teal the product
       already uses for its books, because this is the same subject seen
       from the other side of the counter — one shade graver, because
       here it is someone else's money. */
    --bo-signal: #0b6b62;
    --bo-signal-lift: #0e8478;
    --bo-signal-wash: #e6f1ef;

    /* What a month, an invoice or a run can be. Four states, four hues,
       used nowhere else so that a colour always means the same thing. */
    --bo-settled: #1e6b3d;
    --bo-open: #8a5a00;
    --bo-late: #a52a1f;
    --bo-trial: #4a4fb5;
    --bo-nothing: #dedbd4;

    --bo-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --bo-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", "Liberation Mono", Menlo, monospace;

    min-height: 100vh;
    display: grid;
    grid-template-columns: 15rem 1fr;
    background: var(--bo-paper);
    color: var(--bo-text);
    font-family: var(--bo-sans);
}

/* ------------------------------------------------------------- the rail */

.bo-rail {
    background: var(--bo-ink);
    color: #cfd2d9;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* The rail does not lead with a logo. A machine room leads with its
   readings: what the service is owed right now, and how much of that is
   late. The brand is on the public site; here, the number is the news. */
.bo-gauge {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bo-gauge__word {
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7c828f;
}

.bo-gauge__figure {
    display: block;
    font-family: var(--bo-mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #fff;
    margin-top: 0.15rem;
}

.bo-gauge__late {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: #e59a92;
}

.bo-gauge__late .bo-amount {
    color: #e59a92;
}

.bo-nav {
    padding: 0.75rem 0.5rem;
    flex: 1;
}

.bo-nav__group {
    margin-bottom: 0.9rem;
}

.bo-nav__label {
    padding: 0.35rem 0.75rem;
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #676d7a;
}

.bo-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    border-radius: 0.375rem;
    color: #cfd2d9;
    text-decoration: none;
    font-size: 0.9375rem;
}

.bo-nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.bo-nav a.is-current {
    background: var(--bo-signal);
    color: #fff;
}

.bo-nav a .ti {
    font-size: 1.0625rem;
    opacity: 0.85;
}

.bo-nav__count {
    margin-left: auto;
    font-family: var(--bo-mono);
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    padding: 0 0.4rem;
}

.bo-nav a.is-current .bo-nav__count {
    background: rgba(0, 0, 0, 0.25);
}

.bo-whoami {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.bo-whoami__mail {
    font-family: var(--bo-mono);
    font-size: 0.75rem;
    color: #9ba1ac;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bo-whoami button {
    margin-left: auto;
    background: none;
    border: 0;
    color: #9ba1ac;
    padding: 0.25rem;
    cursor: pointer;
}

.bo-whoami button:hover {
    color: #fff;
}

/* ------------------------------------------------------------ the sheet */

.bo-main {
    min-width: 0;
    padding: 1.75rem 2rem 4rem;
}

.bo-head {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bo-ink);
    margin-bottom: 1.5rem;
}

.bo-head__text {
    min-width: 0;
}

.bo-crumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bo-muted);
}

.bo-crumb a {
    color: var(--bo-muted);
    text-decoration: none;
}

.bo-crumb a:hover {
    color: var(--bo-signal);
}

.bo-title {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--bo-ink);
    margin: 0.15rem 0 0;
}

.bo-subtitle {
    color: var(--bo-muted);
    margin: 0.35rem 0 0;
    font-size: 0.9375rem;
}

.bo-head__actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* -------------------------------------------------------------- figures */

/* The four readings at the top of the dashboard. Not cards — a card puts
   a box around a number and the box says nothing. A rule above each
   figure groups them into one instrument panel. */
.bo-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.bo-figure {
    border-top: 2px solid var(--bo-rule-strong);
    padding-top: 0.6rem;
}

.bo-figure--late {
    border-top-color: var(--bo-late);
}

.bo-figure__label {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bo-muted);
}

.bo-figure__value {
    display: block;
    font-family: var(--bo-mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--bo-ink);
    margin-top: 0.2rem;
}

.bo-figure__note {
    font-size: 0.8125rem;
    color: var(--bo-muted);
}

/* ------------------------------------------------- the signature: strip */

/* Twelve or twenty-four months of one association, as the account
   statement they are. Each cell is one month; its colour is what that
   month was. Read left to right, a customer's whole history with the
   service is one glance wide — which is the question the operator
   actually has when they look at a list of clubs. */
.bo-strip {
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.bo-strip__cell {
    width: 0.5rem;
    height: 1.375rem;
    border-radius: 1px;
    background: var(--bo-nothing);
}

.bo-strip--wide .bo-strip__cell {
    width: 100%;
    flex: 1;
    height: 2.5rem;
    border-radius: 2px;
}

.bo-strip__cell[data-state="paid"] { background: var(--bo-settled); }
.bo-strip__cell[data-state="open"] { background: var(--bo-open); }
.bo-strip__cell[data-state="overdue"] { background: var(--bo-late); }
.bo-strip__cell[data-state="trial"] { background: var(--bo-trial); }
.bo-strip__cell[data-state="exempt"] {
    background: repeating-linear-gradient(
        45deg, var(--bo-nothing), var(--bo-nothing) 2px, #fff 2px, #fff 4px
    );
}

.bo-strip-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--bo-muted);
}

.bo-strip-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.bo-strip-legend i {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 1px;
    display: inline-block;
    background: var(--bo-nothing);
}

.bo-strip-legend i[data-state="paid"] { background: var(--bo-settled); }
.bo-strip-legend i[data-state="open"] { background: var(--bo-open); }
.bo-strip-legend i[data-state="overdue"] { background: var(--bo-late); }
.bo-strip-legend i[data-state="trial"] { background: var(--bo-trial); }

.bo-strip-scale {
    display: flex;
    justify-content: space-between;
    font-family: var(--bo-mono);
    font-size: 0.6875rem;
    color: var(--bo-muted);
    margin-top: 0.3rem;
}

/* --------------------------------------------------------------- tables */

/* Full-width rules, no card. A table is already a grid; wrapping it in a
   rounded box adds a second one that means nothing. */
.bo-sheet {
    background: var(--bo-surface);
    border: 1px solid var(--bo-rule);
    border-radius: 0.25rem;
    overflow: hidden;
}

.bo-sheet + .bo-sheet {
    margin-top: 1.5rem;
}

.bo-sheet__head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--bo-rule);
    flex-wrap: wrap;
}

.bo-sheet__title {
    font-size: 0.8125rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bo-muted);
    margin: 0;
}

.bo-scroll {
    overflow-x: auto;
}

table.bo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

table.bo-table th {
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bo-muted);
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--bo-rule);
    white-space: nowrap;
}

table.bo-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--bo-rule);
    vertical-align: middle;
}

table.bo-table tbody tr:last-child td {
    border-bottom: 0;
}

table.bo-table tbody tr:hover {
    background: #fbfaf8;
}

table.bo-table .bo-num,
table.bo-table th.bo-num {
    text-align: right;
}

.bo-name {
    font-weight: 600;
    color: var(--bo-ink);
    text-decoration: none;
}

.bo-name:hover {
    color: var(--bo-signal);
}

/* Everything a machine issued or a machine reads. */
.bo-id,
.bo-amount {
    font-family: var(--bo-mono);
    font-variant-numeric: tabular-nums;
}

.bo-id {
    font-size: 0.8125rem;
    color: var(--bo-muted);
}

.bo-amount {
    white-space: nowrap;
}

.bo-amount--late {
    color: var(--bo-late);
    font-weight: 600;
}

/* --------------------------------------------------------------- states */

.bo-state {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid currentColor;
    white-space: nowrap;
}

.bo-state--paid { color: var(--bo-settled); }
.bo-state--issued { color: var(--bo-open); }
.bo-state--overdue { color: var(--bo-late); }
.bo-state--draft { color: var(--bo-muted); }
.bo-state--cancelled { color: var(--bo-muted); text-decoration: line-through; }
.bo-state--trial { color: var(--bo-trial); }
.bo-state--exempt { color: var(--bo-muted); }

/* -------------------------------------------------------------- filters */

.bo-filters {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.bo-filters a {
    font-size: 0.8125rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    color: var(--bo-muted);
    text-decoration: none;
    border: 1px solid transparent;
}

.bo-filters a:hover {
    border-color: var(--bo-rule-strong);
    color: var(--bo-text);
}

.bo-filters a.is-current {
    background: var(--bo-signal-wash);
    border-color: var(--bo-signal);
    color: var(--bo-signal);
    font-weight: 600;
}

.bo-search {
    margin-left: auto;
    display: flex;
    gap: 0.35rem;
}

.bo-search input {
    border: 1px solid var(--bo-rule-strong);
    border-radius: 0.25rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.875rem;
    min-width: 12rem;
    background: var(--bo-surface);
}

.bo-search input:focus {
    outline: 2px solid var(--bo-signal);
    outline-offset: 1px;
    border-color: var(--bo-signal);
}

/* -------------------------------------------------------------- buttons */

.bo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 0.25rem;
    border: 1px solid var(--bo-rule-strong);
    background: var(--bo-surface);
    color: var(--bo-text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.bo-btn:hover {
    border-color: var(--bo-ink);
    color: var(--bo-ink);
}

.bo-btn--primary {
    background: var(--bo-signal);
    border-color: var(--bo-signal);
    color: #fff;
}

.bo-btn--primary:hover {
    background: var(--bo-signal-lift);
    border-color: var(--bo-signal-lift);
    color: #fff;
}

.bo-btn--danger:hover {
    border-color: var(--bo-late);
    color: var(--bo-late);
}

.bo-btn--quiet {
    border-color: transparent;
    background: none;
    color: var(--bo-muted);
}

.bo-btn--quiet:hover {
    color: var(--bo-signal);
}

.bo-btn:focus-visible,
.bo-nav a:focus-visible,
.bo-name:focus-visible {
    outline: 2px solid var(--bo-signal);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------- forms */

.bo-form {
    background: var(--bo-surface);
    border: 1px solid var(--bo-rule);
    border-radius: 0.25rem;
    padding: 1.5rem;
    max-width: 44rem;
}

.bo-form .form-label,
.bo-login__box .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bo-ink);
}

/* Tabler's own focus ring is its blue. Inside this app the accent is the
   petrol, and a focus ring in a colour the page uses nowhere else reads
   as a different application's control. */
.bo .form-control:focus,
.bo .form-select:focus,
.bo-form input:focus {
    border-color: var(--bo-signal);
    box-shadow: 0 0 0 0.15rem var(--bo-signal-wash);
}

.bo-form .form-text {
    color: var(--bo-muted);
}

.bo-form__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bo-rule);
}

.bo-note {
    background: var(--bo-signal-wash);
    border-left: 3px solid var(--bo-signal);
    padding: 0.7rem 0.9rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* The service is off the air. Loud on purpose — this is the one state in
   the app that everybody outside it can see. */
.bo-note--alert {
    background: #fdeceb;
    border-left-color: var(--bo-late);
    color: var(--bo-late);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.bo-form--alert {
    border-color: var(--bo-late);
}

.bo-form + .bo-form {
    margin-top: 1.5rem;
}

/* --------------------------------------------------------------- pieces */

.bo-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1.5rem;
    align-items: start;
}

/* Side by side the sheets are not stacked, so the stacking margin would only
   push the second column down. The grid gap already separates them. */
.bo-columns > .bo-sheet + .bo-sheet {
    margin-top: 0;
}

.bo-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 1.25rem;
    font-size: 0.9375rem;
    margin: 0;
}

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

.bo-facts dd {
    margin: 0;
    color: var(--bo-ink);
}

.bo-meter {
    height: 0.375rem;
    background: var(--bo-nothing);
    border-radius: 0.1875rem;
    overflow: hidden;
    margin-top: 0.3rem;
}

.bo-meter span {
    display: block;
    height: 100%;
    background: var(--bo-signal);
}

.bo-meter--full span {
    background: var(--bo-late);
}

.bo-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--bo-muted);
}

.bo-empty__word {
    font-size: 1.0625rem;
    color: var(--bo-text);
    margin-bottom: 0.75rem;
}

.bo-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--bo-rule);
    font-size: 0.875rem;
    color: var(--bo-muted);
}

.bo-messages {
    margin-bottom: 1.25rem;
    display: grid;
    gap: 0.5rem;
}

.bo-message {
    padding: 0.6rem 0.9rem;
    border-left: 3px solid var(--bo-signal);
    background: var(--bo-surface);
    font-size: 0.9375rem;
}

.bo-message--error {
    border-left-color: var(--bo-late);
}

/* ---------------------------------------------------------------- login */

/* Carries the same variables as .bo — hence the shared class — but none of
   its two-column shape: there is no rail before somebody is signed in. */
.bo-login {
    grid-template-columns: 1fr;
    place-items: center;
    background: var(--bo-ink);
    padding: 2rem 1rem;
}

.bo-login__box {
    width: min(24rem, 100%);
    background: var(--bo-surface);
    border-radius: 0.375rem;
    padding: 2rem;
}

/* The wordmark leads back to the public site — the way out of a login
   page for somebody who landed on the wrong one. */
.bo-login__word {
    display: inline-block;
    font-size: 0.6875rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--bo-muted);
    text-decoration: none;
}

.bo-login__word:hover,
.bo-login__word:focus-visible {
    color: var(--bo-ink);
    text-decoration: underline;
}

.bo-login__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--bo-ink);
    margin: 0.15rem 0 1.5rem;
}

.bo-login__aside {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: var(--bo-muted);
}

.bo-maintenance__note {
    color: var(--bo-text);
    margin: 0;
    white-space: pre-line;
}

.bo-login__aside a,
.bo-main a:not(.bo-btn):not(.bo-name):not(.bo-id) {
    color: var(--bo-signal);
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 60rem) {
    .bo {
        grid-template-columns: 1fr;
    }

    .bo-rail {
        position: static;
        height: auto;
    }

    .bo-nav {
        display: flex;
        gap: 0.25rem;
        overflow-x: auto;
        padding: 0.5rem;
    }

    .bo-nav__group {
        display: flex;
        gap: 0.25rem;
        margin: 0;
    }

    .bo-nav__label {
        display: none;
    }

    .bo-nav a {
        white-space: nowrap;
    }

    .bo-main {
        padding: 1.25rem 1rem 3rem;
    }
}

/* The typed confirmation before an irreversible deletion. Narrow on
   purpose: it takes a slug, and a field the width of the page invites a
   sentence. */
.bo-confirm {
    max-width: 22rem;
}

@media (prefers-reduced-motion: reduce) {
    .bo * {
        transition: none !important;
        animation: none !important;
    }
}
