/* Finance Bridge: one stylesheet for the finance UI. No inline styles anywhere (the CSP forbids them). */

/* Atkinson Hyperlegible tells 0 from O and 1 from l and I: amounts, references and account numbers. */
@font-face {
    font-family: "Atkinson Hyperlegible Next";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Atkinson Hyperlegible Mono";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
    color-scheme: light;

    /* The Elevation Church's colours, from elevationng.org */
    --ink: #1e1e1e;
    --ink-soft: #4a4a47;
    --ink-faint: #6b6b68;
    --paper: #f0f5fc;
    --sheet: #ffffff;
    --rule: #d9e4ef;
    --rule-strong: #aebfd1;

    --brand: #1a699c;
    --brand-dark: #101e6d;
    --brand-tint: #e8f2f9;
    --brand-accent: #c5d51a;
    --shade: 1, 20, 43;

    --amber: #c77a12;
    --amber-ink: #7a4200;
    --amber-wash: #fbefda;
    --green: #2f8a57;
    --green-ink: #17603a;
    --green-wash: #e1f1e6;
    --red: #c2402f;
    --red-ink: #9a2316;
    --red-wash: #fae7e3;
    --grey-wash: #e9eff6;

    --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

    --step--1: 0.875rem;
    --step-0: 1rem;
    --step-1: 1.1875rem;
    --step-2: 1.4375rem;
    --step-3: 1.75rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    --radius-small: 4px;
    --radius: 6px;
    --radius-large: 10px;

    font-family: var(--sans);
    font-size: 100%;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    -webkit-text-size-adjust: 100%;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
}

a {
    color: var(--brand);
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
}

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

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

h1, h2, h3 {
    line-height: 1.2;
    margin: 0;
    font-weight: 700;
}

h1 {
    font-size: var(--step-3);
    letter-spacing: -0.01em;
}

h2 {
    font-size: var(--step-2);
    letter-spacing: -0.005em;
}

h3 {
    font-size: var(--step-1);
}

p {
    margin: 0 0 var(--space-4);
}

code, .mono {
    font-family: var(--mono);
    font-size: 0.92em;
    color: var(--ink-soft);
}

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

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

.skip-link {
    position: absolute;
    left: -999px;
}

.skip-link:focus {
    left: var(--space-4);
    top: var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: var(--sheet);
    border-radius: var(--radius);
    z-index: 20;
}

/* The shell: navigation on the left on wide screens, above the page on narrow ones */

.app {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    min-height: 100vh;
}

.app--bare {
    grid-template-columns: minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-5) var(--space-4) var(--space-4);
}

.sidebar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

/* The mark sits on the word's baseline: its arch is as tall as the capitals and its legs hang below
   like the g's descender. Sized in em, so the two stay matched at any size. */
.brand {
    display: inline-block;
    white-space: nowrap;
    padding: var(--space-1) var(--space-2);
    font-weight: 750;
    font-size: var(--step-1);
    line-height: 1.5;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-decoration: none;
}

.brand:hover {
    color: var(--ink);
    text-decoration: none;
}

.brand__mark {
    width: 2.33em;
    height: 1.165em;
    /* With the space the markup leaves before the word */
    margin-right: 0.1em;
    vertical-align: -0.355em;
    color: var(--brand);
}

.sidebar .menu-toggle {
    display: none;
}

.site-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* A group's heading: smaller, lighter and spaced, under a rule, so it never reads as a link */
.site-nav > div + div {
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

.site-nav__group {
    margin: 0 0 var(--space-2);
    padding: 0 var(--space-2);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    cursor: default;
}

.site-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 0.4rem var(--space-2);
    border-radius: var(--radius);
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 500;
}

.site-nav a:hover {
    background: var(--grey-wash);
    color: var(--ink);
}

.site-nav a[aria-current="page"] {
    background: var(--sheet);
    color: var(--ink);
    font-weight: 700;
    box-shadow: 0 0 0 1px var(--rule);
}

.nav-count {
    min-width: 1.6rem;
    padding: 0 0.4rem;
    border-radius: var(--radius-small);
    background: var(--amber-wash);
    color: var(--amber-ink);
    font-size: var(--step--1);
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.site-user {
    margin-top: auto;
    padding: var(--space-3) var(--space-2) 0;
    border-top: 1px solid var(--rule);
    font-size: var(--step--1);
}

.site-user__name {
    display: block;
    font-weight: 700;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.site-user__role {
    display: block;
    color: var(--ink-faint);
    margin-bottom: var(--space-2);
}

.site-user form {
    margin: 0;
}

.content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--sheet);
    border-left: 1px solid var(--rule);
}

.app--bare .content {
    border-left: 0;
}

.app--bare .content {
    background: var(--paper);
}

main {
    flex: 1;
}

.site-footer {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-7);
    color: var(--ink-faint);
    font-size: var(--step--1);
    border-top: 1px solid var(--rule);
}

.site-footer__logo {
    width: 1.25rem;
    height: auto;
    flex: none;
}

/* The application's logo above a page shown before sign-in */
.bare-brand {
    display: flex;
    justify-content: center;
    padding: max(var(--space-6), 6vh) var(--space-5) 0;
}

/* The mark alone, larger; its 2:1 shape kept */
.bare-brand .brand__mark {
    width: 6rem;
    height: 3rem;
    margin-right: 0;
    vertical-align: middle;
}

@media (max-width: 60rem) {
    .app {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: static;
        height: auto;
        border-bottom: 1px solid var(--rule);
        padding: var(--space-3) var(--space-4);
        gap: var(--space-4);
    }

    .sidebar.has-menu .menu-toggle {
        display: inline-flex;
    }

    .sidebar.has-menu:not(.is-open) .site-nav,
    .sidebar.has-menu:not(.is-open) .site-user {
        display: none;
    }

    .site-user {
        margin-top: 0;
    }

    .content {
        border-left: 0;
    }

    .site-footer {
        padding: var(--space-4);
    }
}

/* Pages */

/* Pages fill the width, for tables; prose and forms keep their own measure */
.page {
    width: 100%;
    padding: var(--space-6) var(--space-7) var(--space-7);
}

.page--narrow {
    max-width: 44rem;
}

/* Close under the logo: the room above the page is above the logo */
.app--bare .page--narrow {
    margin: 0 auto;
    padding-top: var(--space-5);
}

@media (max-width: 60rem) {
    .page {
        padding: var(--space-5) var(--space-4) var(--space-6);
    }
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}

.page-head__title {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.back {
    margin: 0;
    font-size: var(--step--1);
}

.lede {
    max-width: 68ch;
    color: var(--ink-soft);
    margin-bottom: var(--space-5);
}

.muted {
    color: var(--ink-soft);
}

.small {
    font-size: var(--step--1);
}

.section {
    margin-top: var(--space-7);
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-3);
}

.section-head p {
    margin: 0;
}

.prose {
    max-width: 68ch;
}

/* How a page works, folded away under its heading: spaced like the lede it replaces */
details.prose {
    margin-bottom: var(--space-5);
}

details.prose > p {
    margin-bottom: var(--space-2);
}

/* A bordered area for one task: a form, an account, a resolution */
.panel {
    border: 1px solid var(--rule);
    border-radius: var(--radius-large);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    background: var(--sheet);
}

.panel > :last-child {
    margin-bottom: 0;
}

.panel--tinted {
    background: var(--paper);
    border-color: transparent;
}

.panel--attention {
    border-color: var(--amber);
    border-width: 1.5px;
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}

.panel-head h2,
.panel-head h3 {
    margin: 0;
}

/* What's empty, and what to do about it: across the page, its text centred at a readable width */
.empty {
    padding: var(--space-6) max(var(--space-5), calc((100% - 68ch) / 2));
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius-large);
    color: var(--ink-soft);
    text-align: center;
}

.empty > :last-child {
    margin-bottom: 0;
}

.empty strong {
    display: block;
    color: var(--ink);
    font-size: var(--step-1);
    margin-bottom: var(--space-1);
}

/* Messages after an action */

.notice,
.form-error {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-5);
    max-width: 68ch;
    font-weight: 500;
}

.notice {
    background: var(--green-wash);
    color: var(--green-ink);
    border: 1px solid var(--green);
}

.form-error {
    background: var(--red-wash);
    color: var(--red-ink);
    border: 1px solid var(--red);
}

.warning {
    color: var(--red-ink);
    font-weight: 600;
}

/* States, as a dot and a word */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-small);
    background: var(--grey-wash);
    color: var(--ink-soft);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.chip::before {
    content: "";
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.chip--good {
    background: var(--green-wash);
    color: var(--green-ink);
}

.chip--attention {
    background: var(--amber-wash);
    color: var(--amber-ink);
}

.chip--problem {
    background: var(--red-wash);
    color: var(--red-ink);
}

.chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* Buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.5rem;
    padding: 0.45rem 1rem;
    border: 1px solid var(--brand);
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
    text-decoration: none;
}

.button--quiet {
    background: var(--sheet);
    color: var(--brand);
    border-color: var(--rule-strong);
}

.button--quiet:hover {
    background: var(--brand-tint);
    border-color: var(--brand);
    color: var(--brand-dark);
}

.button--danger {
    background: var(--sheet);
    color: var(--red-ink);
    border-color: var(--rule-strong);
}

.button--danger:hover {
    background: var(--red-wash);
    border-color: var(--red);
    color: var(--red-ink);
}

.button--small {
    min-height: 2rem;
    padding: 0.25rem 0.7rem;
    font-size: var(--step--1);
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    cursor: pointer;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

/* Forms */

.form {
    max-width: 40rem;
}

.field {
    margin-bottom: var(--space-5);
}

.field > label,
.field > legend,
.label {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: 600;
}

.hint {
    margin: var(--space-1) 0 0;
    font-size: var(--step--1);
    color: var(--ink-soft);
}

.field-error {
    margin: var(--space-1) 0 0;
    font-size: var(--step--1);
    font-weight: 600;
    color: var(--red-ink);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="email"],
input[type="search"],
input:not([type]),
select {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--sheet);
    color: var(--ink);
    font: inherit;
}

input[type="file"] {
    font: inherit;
    max-width: 100%;
}

input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 0;
    border-color: var(--brand);
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: var(--red);
}

input:disabled,
select:disabled {
    background: var(--grey-wash);
    color: var(--ink-soft);
}

.field-row {
    display: grid;
    grid-template-columns: 7rem 1fr 1fr;
    gap: var(--space-2);
}

@media (max-width: 30rem) {
    .field-row {
        grid-template-columns: 1fr;
    }
}

.form-section {
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--rule);
}

.form-section > legend {
    font-size: var(--step-1);
    font-weight: 700;
    margin-bottom: var(--space-4);
}

/* Choices shown as selectable rows */
.choices {
    display: grid;
    gap: var(--space-2);
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--sheet);
    cursor: pointer;
}

.choice input {
    margin: 0.3rem 0 0;
    accent-color: var(--brand);
}

.choice label {
    font-weight: 600;
    cursor: pointer;
}

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

/* The category matters only when posting: where :has() works, it shows once Post is chosen */
@supports selector(:has(*)) {
    .resolve .when-posting {
        display: none;
    }

    .resolve:has(input[value="POST"]:checked) .when-posting {
        display: block;
    }
}

/* Filters above a list; with JavaScript they apply as they change */

/* The fields share the bar's full width, wrapping onto more rows when narrow */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    align-items: end;
    gap: var(--space-3) var(--space-4);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
    background: var(--paper);
    border-radius: var(--radius-large);
}

.filters label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--step--1);
    font-weight: 600;
}

.filters__submit {
    justify-self: start;
}

/* One field and its button, such as a new category */
.add-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
    background: var(--paper);
    border-radius: var(--radius-large);
}

.add-form > div {
    flex: 1 1 18rem;
    max-width: 32rem;
}

.add-form label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--step--1);
    font-weight: 600;
}

.add-form .field-error {
    flex-basis: 100%;
}

.js .filters__submit {
    display: none;
}

.results {
    transition: opacity 0.15s ease;
}

.results.htmx-request {
    opacity: 0.5;
}

/* Tables */

.table-wrap {
    overflow-x: auto;
    margin-bottom: var(--space-4);
    border-top: 1px solid var(--rule-strong);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.table th,
.table td {
    text-align: left;
    vertical-align: top;
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.table th:first-child,
.table td:first-child {
    padding-left: 0;
}

.table thead th {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-size: var(--step--1);
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
}

.table tbody th {
    font-weight: 600;
}

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

.table .amount--in {
    color: var(--green-ink);
}

.nowrap {
    white-space: nowrap;
}

.narration {
    max-width: 26rem;
    overflow-wrap: anywhere;
}

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

.narration a:hover,
.narration a:focus-visible {
    color: var(--brand);
    text-decoration: underline;
}

.account-name {
    display: block;
}

.account-name + code {
    font-size: 0.85em;
}

.pager {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

/* Label and value pairs */

.details {
    display: grid;
    grid-template-columns: minmax(8rem, max-content) 1fr;
    gap: var(--space-2) var(--space-5);
    margin: 0 0 var(--space-4);
}

.details dt {
    color: var(--ink-soft);
}

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

@media (max-width: 30rem) {
    .details {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .details dd {
        margin-bottom: var(--space-3);
    }
}

/* Facts side by side, label above value */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: var(--space-4) var(--space-5);
    margin: 0;
}

.facts dt {
    font-size: var(--step--1);
    color: var(--ink-soft);
    margin-bottom: 0.15rem;
}

.facts dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.facts dd .muted,
.facts dd .small {
    font-weight: 400;
}

/* The overview: one sentence on the books, then what needs a person */

.overview {
    max-width: 60rem;
    margin-bottom: var(--space-6);
}

.headline {
    font-size: clamp(1.875rem, 1.2rem + 2.4vw, 2.875rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.08;
    margin: var(--space-2) 0 var(--space-4);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1em 0.35em;
}

/* The count, apart from the words: a block in the colour of how serious it is */
.headline__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35em;
    height: 1.35em;
    padding: 0 0.28em;
    border-radius: 0.22em;
    background: var(--amber);
    color: #fff;
    font-size: 0.92em;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1;
}

.overview--problem .headline__count {
    background: var(--red);
}

.headline__lamp {
    display: inline-block;
    flex: none;
    width: 0.42em;
    height: 0.42em;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 0.12em var(--green-wash);
}

.overview--attention .headline__lamp {
    background: var(--amber);
    box-shadow: 0 0 0 0.12em var(--amber-wash);
}

.overview--problem .headline__lamp {
    background: var(--red);
    box-shadow: 0 0 0 0.12em var(--red-wash);
}

.overview__as-of {
    color: var(--ink-soft);
    font-size: var(--step--1);
}

.attention {
    list-style: none;
    margin: var(--space-5) 0 0;
    padding: 0;
    border-top: 1px solid var(--rule);
}

.attention li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) 0 var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--rule);
    position: relative;
}

/* Each item's tone as a dot, like the chips */
.attention li::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: calc(var(--space-3) + 0.5em);
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--rule-strong);
}

.attention__text {
    flex: 1 1 24rem;
    max-width: 62ch;
}

.attention .tone-problem::before {
    background: var(--red);
}

.attention .tone-attention::before {
    background: var(--amber);
}

.attention .tone-note {
    color: var(--ink-soft);
}

/* One account on the overview */

.accounts {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.account {
    border: 1px solid var(--rule);
    border-radius: var(--radius-large);
    padding: var(--space-4) var(--space-5) var(--space-5);
}

.account__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--rule);
}

.account__head h3 {
    margin-right: auto;
}

.account__head h3 code {
    margin-left: var(--space-2);
    font-weight: 400;
}

/* The hold queue */

.queue {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--rule-strong);
}

.queue__item {
    border-bottom: 1px solid var(--rule);
}

.queue__link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-1) var(--space-5);
    padding: var(--space-4) var(--space-3);
    color: var(--ink);
    text-decoration: none;
}

.queue__link:hover {
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
}

.queue__link:hover .queue__narration {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

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

.queue__amount {
    grid-row: span 2;
    align-self: center;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.queue__direction {
    display: block;
    font-size: var(--step--1);
    font-weight: 400;
    color: var(--ink-soft);
}

.queue__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    font-size: var(--step--1);
    color: var(--ink-soft);
}

/* One transaction: what to do beside what the bank showed */

.split {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
}

.split > * > :first-child {
    margin-top: 0;
}

.split__side h2 {
    margin-bottom: var(--space-3);
}

@media (max-width: 70rem) {
    .split {
        grid-template-columns: minmax(0, 1fr);
    }

    .split__side {
        order: -1;
    }
}

.amount-title {
    font-variant-numeric: tabular-nums;
}

.amount-title__direction {
    color: var(--ink-soft);
    font-weight: 400;
}

.posting {
    padding-top: var(--space-4);
    margin-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

.posting:first-of-type {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
}

.posting h3 {
    margin-bottom: var(--space-3);
}

/* Steps that really are in order: connecting QuickBooks */

.steps {
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--space-3);
    counter-reset: step;
}

.steps li {
    counter-increment: step;
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-3);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink-soft);
}

.steps li::before {
    content: counter(step);
    flex: none;
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 1px solid var(--rule-strong);
    background: var(--sheet);
    font-weight: 700;
    font-size: var(--step--1);
}

.steps .is-done::before {
    content: "\2713";
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.steps .is-current {
    background: var(--brand-tint);
    color: var(--ink);
    font-weight: 600;
}

.steps .is-current::before {
    border-color: var(--brand);
    color: var(--brand);
}

/* A change made in a panel over the page (the Popover API: no script needed) */

.change-panel {
    width: min(30rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    margin: auto;
    padding: var(--space-5);
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--sheet);
    color: var(--ink);
    box-shadow: 0 24px 60px -16px rgba(var(--shade), 0.4);
}

.change-panel::backdrop {
    background: rgba(var(--shade), 0.35);
}

.change-panel h2 {
    font-size: var(--step-1);
    margin-bottom: var(--space-2);
}

.change-panel form + form {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--rule);
}

.change-panel .field {
    margin-bottom: var(--space-4);
}

/* Where popovers aren't supported, the panels show in place */
@supports not selector(:popover-open) {
    .change-panel {
        width: auto;
        margin: var(--space-3) 0;
        box-shadow: none;
    }

    [popovertargetaction="hide"] {
        display: none;
    }
}

.word-counts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4);
}

.word-counts li {
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-small);
    background: var(--grey-wash);
    font-size: var(--step--1);
}

.status {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--rule-strong);
    margin: 0 0 var(--space-3);
}

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

details > summary {
    cursor: pointer;
    color: var(--brand);
    font-weight: 600;
}

details[open] > summary {
    margin-bottom: var(--space-2);
}

.field-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0 var(--space-4);
}

/* Asking before a change is sent */
.confirm-dialog {
    width: min(28rem, calc(100vw - 2rem));
    padding: var(--space-5);
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--sheet);
    color: var(--ink);
    box-shadow: 0 24px 60px -16px rgba(var(--shade), 0.4);
}

.confirm-dialog::backdrop {
    background: rgba(var(--shade), 0.35);
}

.confirm-dialog__message {
    font-size: var(--step-1);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-5);
}

label .optional {
    font-weight: 400;
    color: var(--ink-soft);
}

/* What can be clicked shows the pointer; browsers leave some controls with the arrow */
button:not(:disabled),
select:not(:disabled),
summary,
label[for],
input[type="radio"]:not(:disabled),
input[type="checkbox"]:not(:disabled),
input[type="file"]:not(:disabled) {
    cursor: pointer;
}

:disabled {
    cursor: not-allowed;
}


.results-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
}

.results-head p {
    margin: 0;
}


/* Six filters, in two rows of three where there is room */
.filters--six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 60rem) {
    .filters--six {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 30rem) {
    .filters--six {
        grid-template-columns: minmax(0, 1fr);
    }
}

.filters__range > legend {
    margin-bottom: var(--space-1);
    font-size: var(--step--1);
    font-weight: 600;
}

.filters__pair {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink-soft);
    font-size: var(--step--1);
}

.filters__pair input {
    min-width: 0;
    flex: 1;
}

/* The search box's own clear button, in plain black (Chrome, Edge and Safari draw one) */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 0.85rem;
    height: 0.85rem;
    margin-left: var(--space-2);
    background: url("icons/clear.svg") center / contain no-repeat;
    cursor: pointer;
}

/* Retired connections and accounts, on the bank accounts screen */
.retired-group + .retired-group {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--rule);
}

.retired-group h3 {
    margin-bottom: var(--space-2);
}

.retired-group ul {
    list-style: none;
    margin: 0 0 var(--space-3);
    padding: 0;
}

.retired-group li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-1) 0;
}
