/* LEYECO II Online: the whole design system.

   The palette is the cooperative's seal, softened for long reading: a blue field, yellow
   machinery, white light. Yellow sits on blue, or as the pale wash of a pause notice.

     --seal        #2B3D9E  chrome, primary buttons, links, focus. White on it 9.3:1.
     --seal-deep   #202E7A  pressed / hovered seal.
     --seal-wash   #ECEEF7  block header bands, hovers, the info notice. Ink on it 13:1.
     --gear        #F0D54A  the gear and the bar's base rule. On --seal 6.6:1.
     --gear-wash   #FBF5DC  the pause notice.
     --gear-ink    #7A5C00  the pause notice's marker and icon. On --gear-wash 5.8:1.
     --ink         #1B2140  text. On --paper 14:1.
     --wire        #4C5270  secondary text. On --surface 7.6:1, on --paper 6.9:1.
     --edge        #858BA3  input borders (non-text, 3.4:1 on white).
     --rule        #DCDFE9  dividers and block outlines.
     --paper       #F3F4F8  the page.
     --surface     #FFFFFF  blocks and inputs.
     --danger      #A0282B  refusals, locks, past due. On --danger-wash 6.5:1.
     --txn-red     #C4161C  a transaction ID, wherever it appears, so the helpdesk can point a
                            member to "the red code". Brighter than --danger, so a paid
                            payment's ID doesn't read as a refusal. On --surface 6.0:1, on
                            --paper 5.5:1, on --gear-wash 5.5:1.
     --paid        #1E6B4E  an account with nothing pending. On --surface 6.4:1, on --paid-wash 5.7:1.
     --paid-wash   #EAF4EE  the disc behind its check.

   Chart marks only (the billing history's columns), run through the dataviz palette
   validator on white: every pair passes colour-blind separation, each is 3:1 or more.

     --chart-paid    #3B50B8  a paid bill: one step lighter than --seal, inside the band.
     --chart-unpaid  #B7860B  unpaid, not yet due: the gear's ochre.
     --chart-late    #A0282B  past due: --danger.

   Type: Public Sans alone (self-hosted under fonts/, SIL OFL), 400 to 700. Figures that line
   up or count down are tabular (.figure).

   Layout: signed out, a slim blue bar over the page; signed in, a blue sidebar beside it
   (a bar with tabs below 960px). Forms and facts sit in blocks read like the boxed sections
   of a bill: an outline, a tinted header band, dense label and value rows, and bills as line
   items in tables that fold into short stacks in a narrow block. Each electric account is a
   card read like a bill with its payment stub: who and where above a perforated rule, what to
   pay and by when below it, its actions at the foot; its account number links the whole card
   to the account's page. A transaction ID comes on a slip torn along the same rule. Every
   page ends on the developers' imprint, small print under a hairline. Corners 3px on
   controls, 6px on cards and dialogs; outlines 1px, focus 2px; no shadows.

   The one loud element is the gear rising behind the signed-out bar's right end. */

@font-face {
    font-family: "Public Sans";
    src: url("../fonts/public-sans-latin.woff2") format("woff2");
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The accented letters past Latin-1 and the peso sign (U+20B1): fetched only when a page shows one. */
@font-face {
    font-family: "Public Sans";
    src: url("../fonts/public-sans-latin-ext.woff2") format("woff2");
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --seal: #2B3D9E;
    --seal-deep: #202E7A;
    --seal-wash: #ECEEF7;
    --gear: #F0D54A;
    --gear-wash: #FBF5DC;
    --gear-ink: #7A5C00;
    --ink: #1B2140;
    --wire: #4C5270;
    --edge: #858BA3;
    --rule: #DCDFE9;
    --paper: #F3F4F8;
    --surface: #FFFFFF;
    --danger: #A0282B;
    --danger-wash: #FBEDED;
    --txn-red: #C4161C;
    --paid: #1E6B4E;
    --paid-wash: #EAF4EE;

    --chart-paid: #3B50B8;
    --chart-unpaid: #B7860B;
    --chart-late: #A0282B;

    --font: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-md: 0.875rem;
    --text-base: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.375rem;

    --radius: 3px;
    --radius-lg: 6px;
    --control-h: 2.5rem;
    --gutter: clamp(16px, 3vw, 28px);
    --rail: 15.5rem;
    --wide: 76rem;
    --narrow: 64rem;
    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Fingers need the larger target; a mouse doesn't. */
@media (pointer: coarse) {
    :root {
        --control-h: 2.75rem;
    }
}

/* ---------------------------------------------------------------- base */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* 16px on a phone (iOS zooms into anything smaller), 15px from a tablet up. */
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
    body {
        font-size: var(--text-base);
    }
}

h1,
h2,
h3,
p,
dl,
dd,
ul {
    margin: 0;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--seal);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    touch-action: manipulation;
}

a:hover {
    color: var(--seal-deep);
    text-decoration-thickness: 2px;
}

:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}

h1:focus,
h1:focus-visible {
    outline: none;
}

.figure {
    font-variant-numeric: tabular-nums;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip {
    position: absolute;
    left: 12px;
    top: -100px;
    z-index: 100;
    padding: 8px 14px;
    background: var(--surface);
    color: var(--seal);
    font-weight: 600;
    border-radius: var(--radius);
}

.skip:focus {
    top: 8px;
}

.icon {
    flex: none;
}

/* ---------------------------------------------------------------- the bar */

/* The base rule is drawn inside the bar, so the yellow still sits on blue. */
.bar {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--seal);
    color: #FFFFFF;
    box-shadow: inset 0 -2px 0 var(--gear);
}

.bar :focus-visible {
    outline-color: var(--gear);
}

.bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: var(--wide);
    min-height: 3.25rem;
    margin: 0 auto;
    padding: 6px var(--gutter) 8px;
}

.bar--narrow .bar__inner {
    max-width: var(--narrow);
}

/* The seal's ring of teeth, rising behind the bar's right end: only its top arc shows. It
   turns one tooth (360° / 16) into place as the page first opens, and not at all under
   reduced motion. */
.bar__gear {
    position: absolute;
    z-index: -1;
    width: 140px;
    height: 140px;
    right: -44px;
    bottom: -90px;
    fill: var(--gear);
    animation: gear-settle 1.1s var(--ease-out) both;
}

@media (min-width: 600px) {
    .bar__gear {
        width: 220px;
        height: 220px;
        right: -36px;
        bottom: -170px;
    }
}

@keyframes gear-settle {
    from {
        transform: rotate(-22.5deg);
    }

    to {
        transform: rotate(0deg);
    }
}

.lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #FFFFFF;
    text-decoration: none;
}

.lockup__seal {
    width: 32px;
    height: 32px;
    flex: none;
}

.lockup__text {
    display: grid;
    line-height: 1.2;
    min-width: 0;
}

.lockup__name {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.005em;
}

.lockup__org {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.86);
    text-wrap: balance;
}

a.lockup:hover {
    color: #FFFFFF;
}

a.lockup:hover .lockup__name {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

@media (max-width: 479px) {
    .lockup__org {
        display: none;
    }
}

/* The signed-out frame: bar, page, imprint, the imprint held at the window's foot when the
   page is short. A flex item with auto margins shrinks to its content, so the page is given
   its width back. */
.frame {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.frame__main {
    flex: 1 0 auto;
    width: 100%;
}

/* ---------------------------------------------------------------- signed-in shell */

/* The page and its imprint, the imprint held at the window's foot when the page is short. */
.shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.shell__body {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    min-width: 0;
}

/* Below 960px a bar over the page, its pages as tabs along its foot; from 960px a sidebar
   held in view as the page scrolls. The yellow rule is drawn inside the blue, as on the
   signed-out bar: along the bar's foot, then down the sidebar's inner edge. */
.rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "lockup session"
        "nav nav";
    align-items: center;
    gap: 6px 12px;
    padding: 8px var(--gutter) 0;
    background: var(--seal);
    color: #FFFFFF;
    box-shadow: inset 0 -2px 0 var(--gear);
}

.rail :focus-visible {
    outline-color: var(--gear);
}

.rail__lockup {
    grid-area: lockup;
    min-height: 2.75rem;
}

.rail__nav {
    grid-area: nav;
    min-width: 0;
}

.nav {
    display: flex;
    gap: 4px;
    padding: 0;
    list-style: none;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--control-h);
    padding: 0 12px;
    border-radius: var(--radius) var(--radius) 0 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: var(--text-md);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 120ms ease-out, color 120ms ease-out;
}

.nav__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
}

/* Where you are: lighter, white, and the gear's yellow under it (beside it in the sidebar). */
.nav__link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    box-shadow: inset 0 -3px 0 var(--gear);
}

.rail__session {
    grid-area: session;
    display: flex;
    align-items: center;
    gap: 14px;
}

.rail__who {
    display: grid;
    min-width: 0;
    text-align: right;
    line-height: 1.25;
}

.rail__name {
    font-size: var(--text-md);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.rail__role {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.86);
}

@media (max-width: 599px) {
    .rail__who {
        display: none;
    }
}

@media (min-width: 960px) {
    .shell {
        display: grid;
        grid-template-columns: var(--rail) minmax(0, 1fr);
    }

    .rail {
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        height: 100vh;
        height: 100dvh;
        padding: 18px 12px 16px;
        overflow-y: auto;
        box-shadow: inset -2px 0 0 var(--gear);
    }

    .rail__lockup {
        min-height: 0;
        padding: 0 6px 22px;
    }

    .nav {
        flex-direction: column;
        gap: 2px;
    }

    .nav__link {
        border-radius: var(--radius);
    }

    .nav__link.active {
        box-shadow: inset 3px 0 0 var(--gear);
    }

    .rail__session {
        display: grid;
        gap: 12px;
        margin-top: auto;
        padding: 14px 6px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.18);
    }

    .rail__who {
        text-align: left;
    }

    .rail__signout {
        width: 100%;
    }
}

.shell__main {
    flex: 1 0 auto;
    min-width: 0;
}

@media (min-width: 960px) {
    .shell__main .page {
        padding-top: 28px;
    }
}

/* ---------------------------------------------------------------- imprint */

/* The developers' credit and the release number, set like the printer's imprint and the form's
   revision mark at the foot of a printed bill: small print under a hairline, on the page's own
   column, the number at the far end (under the credit on a phone). Quiet on purpose: the gear
   is the one loud element. */
.imprint {
    width: 100%;
    max-width: var(--wide);
    margin: 0 auto;
    padding: 0 var(--gutter) 20px;
}

.imprint--narrow {
    max-width: var(--narrow);
}

.imprint__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 2px 24px;
    padding-top: 12px;
    border-top: 1px solid var(--rule);
    color: var(--wire);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.imprint__credit {
    text-wrap: balance;
}

.imprint__name {
    color: var(--ink);
    font-weight: 600;
    white-space: nowrap;
}

.imprint__version {
    white-space: nowrap;
}

/* ---------------------------------------------------------------- page */

.page {
    max-width: var(--wide);
    margin: 0 auto;
    padding: 20px var(--gutter) 48px;
}

.page--narrow {
    max-width: var(--narrow);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 24px;
    margin-bottom: 14px;
}

.page-head__title {
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.page-head__aside {
    color: var(--wire);
    font-size: var(--text-md);
}

.page-head__aside strong {
    color: var(--ink);
    font-weight: 600;
}

.page-lede {
    margin: -8px 0 14px;
    max-width: 75ch;
    color: var(--wire);
    font-size: var(--text-md);
}

/* Two columns from 840px: equal halves, or the main column beside a fixed aside. */
.split {
    display: grid;
    gap: 16px;
    align-items: start;
}

@media (min-width: 840px) {
    .split {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .split--aside {
        grid-template-columns: minmax(0, 1fr) 19rem;
    }
}

@media (min-width: 1100px) {
    .split--aside {
        grid-template-columns: minmax(0, 1fr) 22rem;
    }
}

.stack {
    display: grid;
    gap: 16px;
    min-width: 0;
}

/* ---------------------------------------------------------------- blocks */

/* A boxed section of a bill: an outline, a tinted header band, the facts under it. */
.block {
    min-width: 0;
    margin: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}

.block__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 7px 14px;
    background: var(--seal-wash);
    border-bottom: 1px solid var(--rule);
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
    color: var(--ink);
    font-size: var(--text-md);
    font-weight: 700;
    line-height: 1.4;
}

.block__body {
    padding: 14px;
}

.block__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 12px 14px;
    border-top: 1px solid var(--rule);
}

/* A fieldset whose legend is the header band (the float makes a legend lay out like a block). */
.block__section {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.block__section + .block__section {
    border-top: 1px solid var(--rule);
}

.block__section + .block__section .block__head {
    border-radius: 0;
}

.block__legend {
    float: left;
    width: 100%;
}

.block__legend + * {
    clear: both;
}

/* Explanations beside a form or a ledger: a term, then a short paragraph. */
.facts__item {
    display: grid;
    gap: 2px;
    padding: 10px 14px;
    font-size: var(--text-md);
}

.facts__item + .facts__item {
    border-top: 1px solid var(--rule);
}

.facts__item dt {
    font-weight: 700;
}

.facts__item dd {
    line-height: 1.5;
}

/* The account block, read like a bill's: one fact a line, the label led to its value by a
   dotted leader; two columns from 720px, one label over its value below 520px. */
.ledger {
    display: grid;
    column-gap: 32px;
    padding: 2px 14px;
}

.ledger__row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    padding: 9px 0;
}

.ledger__row + .ledger__row {
    border-top: 1px solid var(--rule);
}

.ledger__row dt {
    display: flex;
    flex: 1 1 auto;
    align-items: baseline;
    gap: 8px;
    color: var(--wire);
    font-size: var(--text-md);
    white-space: nowrap;
}

.ledger__row dt::after {
    content: "";
    flex: 1;
    min-width: 16px;
    border-bottom: 1px dotted var(--edge);
    transform: translateY(-0.3em);
}

.ledger__row dd {
    max-width: 65%;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

@media (min-width: 720px) {
    .ledger--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ledger--2 .ledger__row:nth-child(2) {
        border-top: 0;
    }
}

@media (max-width: 519px) {
    .ledger__row {
        display: grid;
        gap: 1px;
    }

    .ledger__row dt::after {
        display: none;
    }

    .ledger__row dd {
        max-width: none;
        text-align: left;
    }
}

.empty {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    color: var(--wire);
    font-size: var(--text-md);
}

.empty .icon {
    margin-top: 1px;
    color: var(--seal);
}

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

.form {
    display: grid;
    gap: 14px;
}

.grid {
    display: grid;
    gap: 12px 16px;
}

@media (min-width: 600px) {
    .grid--2,
    .grid--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field--new-row {
        grid-column-start: 1;
    }
}

@media (min-width: 760px) {
    .grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Label, control, then the hint and the error under it, so the controls of one row line up. */
.field {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
}

.field__label {
    font-size: var(--text-md);
    font-weight: 600;
    line-height: 1.35;
}

.field__optional {
    margin-left: 0.3em;
    font-weight: 400;
    color: var(--wire);
}

.field__hint {
    color: var(--wire);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.field__error {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    color: var(--danger);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.4;
}

.field__error .icon {
    margin-top: 1px;
}

/* 1px border; focused, the border and a 1px outline make a 2px ring. An outline rather than
   a shadow, so the ring survives forced-colours mode. */
.input {
    width: 100%;
    height: var(--control-h);
    padding: 0 10px;
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    transition: border-color 120ms ease-out;
}

.input:hover {
    border-color: var(--wire);
}

.input:focus-visible {
    border-color: var(--seal);
    outline: 1px solid var(--seal);
    outline-offset: 0;
}

.input[aria-invalid="true"] {
    border-color: var(--danger);
}

.input[aria-invalid="true"]:focus-visible {
    outline-color: var(--danger);
}

/* Password box: the toggle sits inside the box's right end. */
.password {
    position: relative;
}

.password__input {
    padding-right: 76px;
}

.password__toggle {
    position: absolute;
    top: 3px;
    right: 3px;
    bottom: 3px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 68px;
    padding: 0 8px;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--seal);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

.password__toggle:hover {
    background: var(--seal-wash);
}

.password__toggle:focus-visible {
    outline-offset: 0;
}

/* The password's rules, ticked off as they are met: the icon and words carry it, not colour alone. */
.rules {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    margin-top: 2px;
    padding: 0;
    list-style: none;
    color: var(--wire);
    font-size: var(--text-sm);
}

.rules__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rules__item--met {
    color: var(--ink);
}

.rules__item--met .icon {
    color: var(--seal);
}

/* Keep me signed in. */
.check {
    display: grid;
    grid-template-columns: 18px 1fr;
    column-gap: 8px;
    align-items: center;
}

.check__box {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--seal);
    cursor: pointer;
}

.check__label {
    font-size: var(--text-md);
    font-weight: 600;
    cursor: pointer;
}

.check__hint {
    grid-column: 2;
    color: var(--wire);
    font-size: var(--text-sm);
    line-height: 1.4;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-h);
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.button:disabled {
    cursor: progress;
    opacity: 0.8;
}

.button--primary {
    background: var(--seal);
    color: #FFFFFF;
}

.button--primary:hover:not(:disabled) {
    background: var(--seal-deep);
    color: #FFFFFF;
}

.button--primary:active:not(:disabled) {
    background: #1A2565;
}

/* Waiting out a pause or a lock: still legible, plainly not pressable. */
.button--held:disabled {
    background: var(--seal-wash);
    border-color: var(--rule);
    color: var(--ink);
    cursor: not-allowed;
    opacity: 1;
}

.button--secondary {
    background: var(--surface);
    border-color: var(--seal);
    color: var(--seal);
}

.button--secondary:hover {
    background: var(--seal-wash);
    color: var(--seal-deep);
}

.button--on-blue {
    min-height: 2.25rem;
    padding: 0 12px;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.6);
    color: #FFFFFF;
    font-size: var(--text-md);
}

.button--on-blue:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

@media (pointer: coarse) {
    .button--on-blue {
        min-height: var(--control-h);
    }
}

.button--block {
    width: 100%;
}

/* A smaller button inside a card or a list; the full height on touch screens. */
.button--compact {
    min-height: 2.25rem;
    padding: 0 12px;
    font-size: var(--text-md);
}

@media (pointer: coarse) {
    .button--compact {
        min-height: var(--control-h);
    }
}

/* Outlined but grey: an action that should be plainly a button without drawing the eye. */
.button--quiet {
    background: var(--surface);
    border-color: var(--edge);
    color: var(--wire);
}

.button--quiet:hover {
    background: var(--seal-wash);
    border-color: var(--wire);
    color: var(--ink);
}

/* ---------------------------------------------------------------- notices */

.notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid;
    border-left-width: 3px;
    border-radius: var(--radius);
    font-size: var(--text-md);
    line-height: 1.45;
}

.notice .icon {
    margin-top: 1px;
}

.notice__body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.notice__title {
    font-weight: 700;
}

.notice__timer {
    margin-top: 2px;
    font-weight: 600;
}

.notice--info {
    border-color: #C3C9E8;
    border-left-color: var(--seal);
    background: var(--seal-wash);
}

.notice--info .icon {
    color: var(--seal);
}

.notice--error {
    border-color: #EBC5C6;
    border-left-color: var(--danger);
    background: var(--danger-wash);
}

.notice--error .icon {
    color: var(--danger);
}

.notice--caution {
    border-color: #E8D898;
    border-left-color: var(--gear-ink);
    background: var(--gear-wash);
}

.notice--caution .icon {
    color: var(--gear-ink);
}

/* ---------------------------------------------------------------- electric accounts */

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    min-height: var(--control-h);
    margin-bottom: 14px;
}

.section-head__title {
    font-size: var(--text-lg);
    font-weight: 700;
    line-height: 1.3;
}

.accounts__notice {
    margin-bottom: 14px;
}

.accounts__notice:focus {
    outline: none;
}

.accounts__notice:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}

.accounts__error {
    display: grid;
    justify-items: start;
    gap: 12px;
    max-width: 40rem;
}

.button--danger {
    background: var(--danger);
    color: #FFFFFF;
}

.button--danger:hover:not(:disabled) {
    background: #861F22;
}

/* A status in words beside the account number, shown only when the account isn't plainly
   connected, so a healthy list stays quiet. */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--wire);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.tag--danger {
    border-color: #EBC5C6;
    background: var(--danger-wash);
    color: var(--danger);
}

/* As many cards a row as fit at 19rem or more; one a row on a phone. A row's cards share
   its height, so their stubs line up. */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 16px;
    padding: 0;
    list-style: none;
}

.cards > li {
    display: grid;
    min-width: 0;
}

/* The whole card opens the account's page: its account number's link stretches over it (the
   ::after below), and the foot's buttons sit above the stretch. */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    transition: border-color 120ms ease-out;
}

.card:hover {
    border-color: var(--edge);
}

.card__body {
    flex: 1;
    display: grid;
    align-content: start;
    gap: 2px;
    padding: 14px 16px 16px;
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.card__id {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    min-width: 0;
}

/* The account number is the card's title: the number a member quotes, in the link colour. */
.card__number {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.25;
}

.card__link {
    color: var(--seal);
    text-decoration: none;
}

.card__link::after {
    content: "";
    position: absolute;
    inset: -1px;
    z-index: 1;
    border-radius: var(--radius-lg);
}

.card:hover .card__link {
    color: var(--seal-deep);
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* The focus ring goes round the whole card, which is what the link opens. */
.card__link:focus-visible {
    outline: none;
}

.card__link:focus-visible::after {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}

.card__chevron {
    margin-top: 3px;
    color: var(--edge);
    transition: color 120ms ease-out, transform 120ms ease-out;
}

.card:hover .card__chevron {
    color: var(--seal);
    transform: translateX(2px);
}

.card__name {
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.card__address,
.card__note {
    color: var(--wire);
    font-size: var(--text-md);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* The account's actions, outlined so they read as buttons: Pay bills in seal blue, Unlink
   grey until pointed at, then the refusal red, and kept at the far end from Pay bills. */
.card__foot {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--rule);
}

.card__unlink {
    margin-left: auto;
}

.card__unlink:hover {
    background: var(--danger-wash);
    border-color: var(--danger);
    color: var(--danger);
}

/* The payment stub, behind a perforated rule with a notch bitten out at each end (a slip's
   too). Each notch is a page-coloured disc centred on the edge, clipped to the half inside
   it, so its outline continues the card's. */
.card__stub {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 4.75rem;
    padding: 14px 16px 15px;
    border-top: 1px dashed var(--edge);
}

.card__stub::before,
.card__stub::after,
.slip__stub::before,
.slip__stub::after {
    content: "";
    position: absolute;
    top: -9px;
    width: 17px;
    height: 17px;
    border: 1px solid var(--rule);
    border-radius: 50%;
    background: var(--paper);
}

.card__stub::before,
.slip__stub::before {
    left: -9px;
    clip-path: inset(0 0 0 8px);
}

.card__stub::after,
.slip__stub::after {
    right: -9px;
    clip-path: inset(0 8px 0 0);
}

/* Something to pay: the stub shaded like a bill's total box; past due, in the refusal red.
   Two columns sharing two rows (subgrid), so the labels line up and so do the figures. */
.card__stub--owing,
.card__stub--past {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: baseline;
    gap: 2px 16px;
}

.card__stub--owing {
    background: var(--seal-wash);
}

.card__stub--past {
    background: var(--danger-wash);
}

.stub__total,
.stub__due {
    display: grid;
    grid-row: 1 / span 2;
    grid-template-rows: subgrid;
    align-items: baseline;
    min-width: 0;
}

/* Inline, so an icon in it can't move its baseline off its neighbour's. */
.stub__label {
    color: var(--wire);
    font-size: var(--text-sm);
    line-height: 1.35;
}

.stub__label .icon {
    margin-right: 4px;
    vertical-align: -2px;
}

.stub__amount {
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.stub__due {
    justify-items: end;
    text-align: right;
}

.stub__date {
    font-weight: 600;
    line-height: 1.5;
}

.card__stub--past .stub__label--late,
.card__stub--past .stub__date {
    color: var(--danger);
    font-weight: 700;
}

/* Nothing pending: no figure to read, a check and the words instead. */

.stub__check {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--paid-wash);
    color: var(--paid);
}

.stub__check .icon {
    stroke-width: 2.25;
}

.stub__clear-title {
    color: var(--paid);
    font-weight: 700;
    line-height: 1.35;
}

.stub__clear-text {
    color: var(--wire);
    font-size: var(--text-sm);
}

/* Not on record, or the bills couldn't be read: a plain sentence where the figures go. */
.stub__message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--wire);
    font-size: var(--text-md);
    line-height: 1.45;
}

.stub__message .icon {
    margin-top: 2px;
}

/* Nothing linked yet: a dashed slot where the first card will go, and the one way to fill it. */
.accounts-empty {
    display: grid;
    justify-items: start;
    gap: 14px;
    max-width: 40rem;
    padding: 24px;
    border: 1px dashed var(--edge);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.accounts-empty__mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--seal-wash);
    color: var(--seal);
}

.accounts-empty__text {
    display: grid;
    gap: 4px;
}

.accounts-empty__title {
    font-size: var(--text-lg);
    font-weight: 700;
    line-height: 1.3;
}

.accounts-empty__text p {
    max-width: 60ch;
    color: var(--wire);
    font-size: var(--text-md);
}

/* While the list loads: still cards where the cards will be, so nothing jumps when they come. */
.card--loading .card__body {
    gap: 8px;
    padding-top: 16px;
}

.placeholder {
    display: block;
    height: 0.9em;
    border-radius: 2px;
    background: var(--seal-wash);
}

.placeholder--number {
    width: 7.5rem;
}

.placeholder--name {
    width: 12rem;
    max-width: 100%;
    height: 1.15em;
}

.placeholder--address {
    width: 16rem;
    max-width: 100%;
}

.placeholder--amount {
    width: 7rem;
    height: 1.8em;
}

.placeholder--button {
    width: 6rem;
    height: 2.25rem;
    border-radius: var(--radius);
}

.profile {
    max-width: 56rem;
}

/* ---------------------------------------------------------------- dialogs */

/* A native modal dialog over a scrim of ink; a sheet from the foot of a phone's screen. It
   rises a few pixels into place, answering the button that opened it. */
.modal {
    width: min(calc(100% - 32px), 30rem);
    max-width: none;
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--ink);
    overflow: auto;
    overscroll-behavior: contain;
}

.modal[open] {
    animation: modal-in 180ms var(--ease-out) both;
}

.modal::backdrop {
    background: rgba(27, 33, 64, 0.55);
}

.modal[open]::backdrop {
    animation: backdrop-in 180ms ease-out both;
}

html:has(.modal[open]) {
    overflow: hidden;
}

.modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px 0 20px;
}

.modal__title {
    padding-top: 8px;
    font-size: var(--text-lg);
    font-weight: 700;
    line-height: 1.35;
}

.modal__close {
    display: grid;
    place-items: center;
    flex: none;
    width: var(--control-h);
    height: var(--control-h);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--wire);
    cursor: pointer;
    touch-action: manipulation;
}

.modal__close:hover {
    background: var(--seal-wash);
    color: var(--ink);
}

.modal__lede {
    padding: 0 20px;
    color: var(--wire);
    font-size: var(--text-md);
}

.modal__body {
    padding: 18px 20px 20px;
}

.modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

@media (max-width: 599px) {
    .modal {
        width: 100%;
        max-height: calc(100dvh - 32px);
        margin: auto 0 0;
        border-width: 1px 0 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal[open] {
        animation-name: sheet-in;
    }

    .modal__body {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .modal__actions .button {
        flex: 1 1 0;
    }
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes sheet-in {
    from {
        transform: translateY(100%);
    }

    to {
        transform: none;
    }
}

@keyframes backdrop-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

.state {
    max-width: 40rem;
}

.state .block__body {
    display: grid;
    gap: 12px;
    justify-items: start;
}

.state__text {
    color: var(--wire);
    font-size: var(--text-md);
}

/* The loading screen, the same in index.html and while the session is read. */
.splash {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 14px;
    padding: 24px;
    background: var(--seal);
    color: #FFFFFF;
    text-align: center;
}

.splash__seal {
    width: 80px;
    height: 80px;
}

.splash__text {
    font-weight: 600;
}

.noscript {
    max-width: 40ch;
    margin: 24px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--ink);
    color: #FFFFFF;
}

#blazor-error-ui .reload {
    color: var(--gear);
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    margin-left: auto;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: #FFFFFF;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ---------------------------------------------------------------- payments */

/* Paid in the paid green; due today in the pause notice's yellow. Words carry it too. */
.tag--paid {
    border-color: #BFDCCB;
    background: var(--paid-wash);
    color: var(--paid);
}

.tag--caution {
    border-color: #E8D898;
    background: var(--gear-wash);
    color: var(--gear-ink);
}

.pay-note {
    max-width: 70ch;
    color: var(--wire);
    font-size: var(--text-sm);
    line-height: 1.5;
}

/* One account's page. Its name and address under the number, then the bills to pay; from
   1200px the payment sits beside them, held in view while the history scrolls past. */
.account-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}

.account-holder {
    display: grid;
    gap: 2px;
    max-width: 75ch;
    margin: -8px 0 18px;
}

.account-holder__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.account-holder__address {
    color: var(--wire);
    font-size: var(--text-md);
    overflow-wrap: anywhere;
}

.account {
    display: grid;
    gap: 16px;
    align-items: start;
}

@media (min-width: 1200px) {
    .account--payable {
        grid-template-columns: minmax(0, 1fr) 20rem;
        grid-template-areas:
            "bills pay"
            "history pay";
    }

    .account--payable .account__bills {
        grid-area: bills;
    }

    .account--payable .pay-panel {
        grid-area: pay;
        position: sticky;
        top: 20px;
    }

    .account--payable .account__history {
        grid-area: history;
    }
}

.account__error {
    display: grid;
    justify-items: start;
    gap: 12px;
}

.history > .account__error {
    padding: 14px;
}

.account__clear {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
}

/* A quiet aside at the right of a block's header band. */
.block__note {
    color: var(--wire);
    font-size: var(--text-sm);
    font-weight: 400;
}

.account__bills,
.history,
.slip__stub,
.payment__panel {
    container: bills / inline-size;
}

/* Older bills first; only the newest can be left out, and this says so under them. */
.bills-rule {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--rule);
    color: var(--wire);
    font-size: var(--text-sm);
}

.bills-rule .icon {
    margin-top: 1px;
    color: var(--seal);
}

/* The payment: the total as the page's one large figure, where to pay, the one button. */
.pay-panel__total {
    display: grid;
    gap: 2px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--rule);
}

.pay-panel__label,
.pay-panel__count {
    color: var(--wire);
    font-size: var(--text-sm);
}

.pay-panel__amount {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.pay-panel__channels {
    min-width: 0;
    margin: 0;
    padding: 0 0 2px;
    border: 0;
    border-bottom: 1px solid var(--rule);
}

.pay-panel__legend {
    float: left;
    width: 100%;
    padding: 10px 14px 0;
    font-size: var(--text-sm);
    font-weight: 700;
}

.pay-panel__legend + * {
    clear: both;
}

.pay-panel__channels > .pay-channel__note {
    display: block;
    padding: 4px 14px 10px;
}

.pay-panel__actions {
    display: grid;
    gap: 10px;
    padding: 14px;
}

/* Where to pay: one radio a line, the channel's name over what it is. */
.pay-channel {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    column-gap: 10px;
    align-items: baseline;
    padding: 10px 14px;
    cursor: pointer;
}

.pay-channel + .pay-channel {
    border-top: 1px solid var(--rule);
}

.pay-channel__radio {
    align-self: center;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--seal);
    cursor: pointer;
}

.pay-channel__text {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.pay-channel__name {
    font-weight: 700;
}

.pay-channel__note {
    color: var(--wire);
    font-size: var(--text-sm);
}

/* Bills as a bill's line items: the month, the period metered, the due date, the figures
   right-aligned with their total last. In a block narrower than 640px each bill folds into
   a short stack: the month and its total, then the period and the due date, labelled. */
.bill-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-md);
}

.bill-table :is(th, td) {
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.bill-table :is(th, td):first-child {
    padding-left: var(--inset, 14px);
}

.bill-table :is(th, td):last-child {
    padding-right: var(--inset, 14px);
}

.bill-table thead th {
    padding-top: 8px;
    padding-bottom: 8px;
    color: var(--wire);
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
}

.bill-table tbody tr {
    border-top: 1px solid var(--rule);
}

.bill-table tbody th {
    font-weight: 700;
    white-space: nowrap;
}

.bill-table .num {
    text-align: right;
    white-space: nowrap;
}

.bill-table .cell-period {
    color: var(--wire);
}

.bill-table .cell-due {
    white-space: nowrap;
}

.bill-table .cell-amount,
.bill-table .cell-surcharge {
    color: var(--wire);
}

.cell-total {
    font-weight: 700;
}

.cell-label,
.cell-note {
    display: none;
}

.cell-hint {
    display: block;
    color: var(--wire);
    font-size: var(--text-sm);
    font-weight: 400;
}

.late {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--danger);
    font-size: var(--text-sm);
    font-weight: 600;
}

.paid-mark {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--wire);
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
}

.paid-mark .icon {
    color: var(--paid);
}

.bill-table tfoot tr {
    border-top: 1px solid var(--rule);
}

/* Shaded like a bill's total box. The figure's cell reaches back over the label's by 2px:
   cells starting at a fraction of a pixel leave a hairline seam between their backgrounds. */
.bill-table tfoot :is(th, td) {
    background: var(--seal-wash);
}

.bill-table tfoot td {
    box-shadow: -2px 0 0 var(--seal-wash);
}

.bill-table tfoot th {
    font-weight: 700;
}

.bill-table tfoot .cell-total {
    font-size: var(--text-lg);
}

/* A bill left for later keeps its line, greyed, its total struck. */
.bill-table tr.is-out :is(.cell-month, .cell-total) {
    color: var(--wire);
}

.bill-table tr.is-out .cell-total {
    font-weight: 600;
    text-decoration: line-through;
}

/* The checkbox's label is the target, larger than the box. */
.bill-table .cell-select {
    width: 1%;
    padding-right: 0;
}

.bill-check {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: -6px 0 -6px -8px;
    border-radius: var(--radius);
    cursor: pointer;
}

.bill-check:hover {
    background: var(--seal-wash);
}

.bill-check:has(:disabled) {
    cursor: default;
}

.bill-check:has(:disabled):hover {
    background: transparent;
}

@media (pointer: coarse) {
    .bill-check {
        width: 44px;
        height: 44px;
        margin: -12px -6px -12px -14px;
    }
}

@container bills (max-width: 639px) {
    .bill-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .bill-table,
    .bill-table tbody,
    .bill-table tfoot {
        display: block;
    }

    /* The month and its figure on the first line; the period and due date under them, the
       full width; a history bill's status at the end of its due line. */
    .bill-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "month figure"
            "period period"
            "due status";
        align-items: baseline;
        gap: 2px 12px;
        padding: 10px var(--inset, 14px);
    }

    .bill-table--select tr {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "select month figure"
            "select period period"
            "select due due";
    }

    .bill-table tbody tr:first-child {
        border-top: 0;
    }

    .bill-table :is(th, td),
    .bill-table :is(th, td):first-child,
    .bill-table :is(th, td):last-child {
        display: block;
        padding: 0;
    }

    .bill-table .cell-select { grid-area: select; align-self: start; }
    .bill-table .cell-month { grid-area: month; white-space: normal; }
    .bill-table .cell-period { grid-area: period; }
    .bill-table .cell-due { grid-area: due; }
    .bill-table .cell-figure { grid-area: figure; }
    .bill-table .cell-status { grid-area: status; justify-self: end; }

    .bill-table .cell-amount,
    .bill-table .cell-surcharge {
        display: none;
    }

    .bill-table :is(.cell-period, .cell-due) {
        font-size: var(--text-sm);
        white-space: normal;
    }

    .bill-table .late {
        display: inline-flex;
        margin-left: 6px;
    }

    .cell-label {
        display: inline;
        margin-right: 4px;
        color: var(--wire);
    }

    .cell-due .cell-label {
        color: var(--wire);
    }

    .cell-note {
        display: block;
        max-width: 8.5rem;
        margin-left: auto;
        color: var(--wire);
        font-size: var(--text-xs);
        font-weight: 400;
        line-height: 1.35;
        white-space: normal;
    }

    .bill-table tfoot tr {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "label figure";
        align-items: baseline;
        background: var(--seal-wash);
    }

    .bill-table .cell-sum-label {
        grid-area: label;
    }

    .bill-check {
        margin: -6px 2px 0 -8px;
    }
}

/* The billing history: one sentence, the chart, the table of the latest twelve bills. */
.history {
    display: grid;
    padding: 0;
}

.history__summary {
    max-width: 70ch;
    padding: 12px 14px 0;
    font-size: var(--text-md);
}

.history > .empty {
    padding: 14px;
}

/* Room is kept for the chart before it draws, so nothing under it jumps. */
.chart {
    min-height: 240px;
    padding: 6px 6px 4px;
}

.chart--loading {
    margin: 14px;
    min-height: 212px;
    border-radius: var(--radius);
    background: var(--seal-wash);
}

.chart__note {
    padding: 0 14px 10px;
    color: var(--wire);
    font-size: var(--text-sm);
}

/* ApexCharts' tooltip in this system's skin: a hairline outline, no shadow, the ink text. */
.chart .apexcharts-tooltip.apexcharts-theme-light {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
}

.chart-tip {
    display: grid;
    gap: 1px;
    padding: 8px 10px;
    color: var(--ink);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.chart-tip__month {
    font-weight: 700;
}

.chart-tip__amount {
    font-size: var(--text-base);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.chart-tip__state,
.chart-tip__period {
    color: var(--wire);
}

.chart-tip__state--late {
    color: var(--danger);
    font-weight: 600;
}

/* A transaction ID is red wherever it appears (the payments list, a payment opened in it, the
   slip and its steps), so "the red code" names it on every page. */
.txn-id {
    color: var(--txn-red);
}

/* A transaction ID: set in fours to read out, copied by its button, scanned from its QR
   code. The page's one large figure. */
.txn-code {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 32px;
}

.txn-code__text {
    display: grid;
    justify-items: start;
    align-content: start;
    gap: 6px;
    min-width: 0;
}

.txn-code__label {
    color: var(--wire);
    font-size: var(--text-sm);
    font-weight: 600;
}

.txn-code__id {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0.08em;
}

.txn-code__id:focus {
    outline: none;
}

.txn-code__id:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 4px;
}

.txn-code__chunk + .txn-code__chunk {
    margin-left: 0.4em;
}

.txn-code__copy {
    margin-top: 4px;
}

.txn-code__qr {
    display: grid;
    justify-items: center;
    gap: 4px;
    margin: 0;
}

.txn-code__qr figcaption {
    color: var(--wire);
    font-size: var(--text-xs);
}

.txn-code--compact .txn-code__id {
    font-size: var(--text-xl);
}

/* Black on white whatever the colour scheme: a camera reads contrast, not the theme. */
.qr {
    display: block;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    forced-color-adjust: none;
}

.qr__ground {
    fill: #FFFFFF;
}

.qr__modules {
    fill: var(--ink);
}

/* Facts as a bill's header boxes: each label over its value, ruled into cells. */
.facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface);
}

/* Each cell rules its right and bottom edges; the outline hides the outermost ones. */
.facts-grid__item {
    display: grid;
    align-content: start;
    gap: 2px;
    min-width: 0;
    margin: 0 -1px -1px 0;
    padding: 10px 14px;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.facts-grid__item--wide {
    grid-column: 1 / -1;
}

.facts-grid dt {
    color: var(--wire);
    font-size: var(--text-sm);
}

.facts-grid dd {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.facts-grid__figure {
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1.2;
}

/* The slip a new transaction ID comes on: the voucher, torn along a card's perforated rule
   from the facts, the bills it pays and how to pay. */
.slip {
    --inset: 20px;
    max-width: 56rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
}

.slip__voucher {
    display: grid;
    gap: 16px;
    padding: 18px var(--inset) 22px;
}

.slip__title {
    font-size: var(--text-lg);
    font-weight: 700;
    line-height: 1.3;
}

.slip__stub {
    position: relative;
    display: grid;
    gap: 12px;
    padding: 20px 0 18px;
    border-top: 1px dashed var(--edge);
}

.slip__stub > :not(.bill-table) {
    margin-inline: var(--inset);
}

.slip__subhead {
    margin-top: 6px;
    font-size: var(--text-md);
    font-weight: 700;
}

.slip__stub > .bill-table {
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.slip__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 14px var(--inset);
    border-top: 1px solid var(--rule);
}

/* How to pay: a real sequence, so its steps are numbered. */
.steps {
    display: grid;
    gap: 8px;
    max-width: 70ch;
    padding: 0;
    list-style: none;
    counter-reset: step;
    font-size: var(--text-md);
}

/* The number hangs in the margin: the step's own text and figures stay one run of text. */
.steps li {
    position: relative;
    min-height: 22px;
    padding-left: 32px;
    counter-increment: step;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--seal-wash);
    color: var(--seal);
    font-size: var(--text-xs);
    font-weight: 700;
}

/* The payments the customer started: a card each, with gaps between, so one payment never
   runs into the next. From 760px the cards' facts line up in columns under one header; below
   it each card stacks them, labelled. Opening a card shows what the payment paid. */
.payments,
.payments__columns {
    --payment-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(7.5rem, auto) 20px;
}

.payments__columns {
    display: none;
}

.payments {
    display: grid;
    gap: 8px;
    max-width: 64rem;
    padding: 0;
    list-style: none;
}

.payment {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    transition: border-color 120ms ease-out;
}

.payment:hover {
    border-color: var(--edge);
}

.payment.is-open {
    border-color: #C3C9E8;
}

.payment__heading {
    font: inherit;
}

.payment__summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "id amount"
        "account chevron"
        "channel chevron";
    align-items: center;
    gap: 2px 16px;
    width: 100%;
    padding: 12px 16px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
}

.payment__summary:hover {
    background: rgba(236, 238, 247, 0.5);
}

.payment__summary:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: -3px;
    border-radius: var(--radius-lg);
}

.payment__id {
    grid-area: id;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    min-width: 0;
}

.payment__code {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: 0.06em;
}

.payment__account {
    grid-area: account;
}

.payment__channel {
    grid-area: channel;
}

.payment__account,
.payment__channel {
    min-width: 0;
    color: var(--ink);
    font-size: var(--text-md);
    overflow-wrap: anywhere;
}

.payment__amount {
    grid-area: amount;
    justify-self: end;
    font-size: var(--text-lg);
    font-weight: 700;
    white-space: nowrap;
}

.payment__chevron {
    grid-area: chevron;
    justify-self: end;
    color: var(--wire);
    transition: transform 160ms var(--ease-out);
}

.payment.is-open .payment__chevron {
    transform: rotate(180deg);
}

/* Labels the columns' header gives from 760px; below it they ride beside their values. */
.payment__key {
    margin-right: 6px;
    color: var(--wire);
    font-size: var(--text-sm);
}

.payment__id .payment__key,
.payment__amount .payment__key {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (min-width: 760px) {
    .payments__columns {
        display: grid;
        grid-template-columns: var(--payment-columns);
        gap: 16px;
        max-width: 64rem;
        padding: 0 17px 6px;
        color: var(--wire);
        font-size: var(--text-sm);
        font-weight: 600;
    }

    .payments__columns .num {
        text-align: right;
    }

    .payment__summary {
        grid-template-columns: var(--payment-columns);
        grid-template-areas: "id account channel amount chevron";
        min-height: 3.5rem;
    }

    .payment__key {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

.payment__panel {
    --inset: 16px;
    display: grid;
    gap: 14px;
    padding: 14px 0 0;
    border-top: 1px solid var(--rule);
    animation: reveal 180ms var(--ease-out) both;
}

.payment__panel > :not(.bill-table) {
    margin-inline: var(--inset);
}

.payment__panel > .bill-table {
    border-top: 1px solid var(--rule);
}

.payment__pay {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--gear-wash);
}

.payment__pay-text {
    max-width: 60ch;
    font-size: var(--text-md);
}

.payment__pay .qr {
    border-color: #E8D898;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------------------------------------------------------------- bill inquiry */

/* An account's bills without signing in, read like an electric account's card: the number,
   name and address above the perforated rule (the card's own classes), what is due below it
   in the card's stub. Not a link, so it doesn't answer a pointer the way a card does. Its
   billing history spans the page under it. */
.statement {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
}

.statement__foot {
    display: grid;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--rule);
}

.statement__note {
    max-width: 60ch;
    color: var(--wire);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.statement__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inquiry__history {
    margin-top: 16px;
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after,
    ::backdrop {
        animation: none !important;
        transition: none !important;
    }
}
