/* =========================================================
   Theme / Variables
   ========================================================= */

:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

/* =========================================================
   Global / Reset
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    min-width: 18rem;
}

body {
    background: radial-gradient(circle at 12% 18%, rgba(203, 180, 120, .23), transparent 28rem), linear-gradient(145deg, #f4f0e4 0%, #e6ecdf 100%);
    color: #30422d;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

button,
input,
textarea,
select {
    font: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    border-radius: .2rem;
    outline: 3px solid rgba(183, 104, 60, .45);
    outline-offset: .2rem;
}

h1:focus {
    outline: none;
}

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

/* =========================================================
   Typography
   ========================================================= */

.eyebrow {
    color: #a25934;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .14em;
    margin: 0;
    text-transform: uppercase;
}

.ledger-form-page .page-intro,
.ledger-form-page .form-note,
.payment-form-page .page-intro,
.ledgers-page .page-intro {
    color: #657160;
}

.cottage-page .page-intro {
    color: #61705e;
    margin: 0 0 2rem;
}

/* =========================================================
   Navigation / Layout
   ========================================================= */

.site-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.site-header {
    padding: 1.25rem clamp(1.25rem, 5vw, 4rem);
}

.site-header a {
    color: #30422d;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
}

.site-shell > main {
    align-items: center;
    display: flex;
    flex: 1;
    justify-content: center;
    padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 5vw, 4rem);
}

.site-shell > footer {
    color: #687164;
    font-size: .82rem;
    padding: 1.5rem;
    text-align: center;
}

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
}

.app-header {
    align-items: center;
    background: rgba(250, 248, 240, .94);
    border-bottom: 1px solid rgba(48, 66, 45, .16);
    display: grid;
    gap: 1.25rem;
    grid-template-columns: auto 1fr auto;
    padding: .95rem clamp(1rem, 4vw, 3rem);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-brand {
    color: #30422d;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    text-decoration: none;
}

.primary-nav a,
.account-actions a,
.app-header .text-button {
    color: #496146;
    text-decoration: none;
}

.primary-nav a {
    border-bottom: 2px solid transparent;
    padding: .8rem .2rem;
}

.primary-nav a.active {
    border-color: #b7683c;
    color: #263a27;
}

.account-actions {
    align-items: center;
    display: flex;
    gap: 1rem;
}

.account-actions form {
    margin: 0;
}

.display-name {
    color: #263a27;
    font-weight: 700;
}

.app-header .text-button {
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0;
}

.app-main {
    margin: 0 auto;
    max-width: 90rem;
    padding: clamp(1.5rem, 4vw, 3.5rem);
}

/* =========================================================
   How to Use
   ========================================================= */

.how-to-page {
    margin: 0 auto;
    max-width: 76rem;
}

.how-to-intro {
    max-width: 54rem;
}

.how-to-page h1,
.how-to-examples > h2,
.how-to-help > h2 {
    font-family: Georgia, "Times New Roman", serif;
}

.how-to-page h1 {
    font-size: clamp(2.5rem, 7vw, 4.75rem);
    letter-spacing: -.035em;
    line-height: 1;
    margin: .35rem 0 1rem;
}

.how-to-lead {
    color: #596b56;
    font-size: clamp(1.05rem, 2.5vw, 1.3rem);
    line-height: 1.65;
}

.how-to-net-example {
    background: #30422d;
    border-radius: 1rem;
    color: #f8f4e8;
    display: grid;
    gap: .4rem;
    margin: 1.5rem 0;
    padding: 1.2rem 1.35rem;
}

.how-to-net-example span {
    color: #e5eadf;
}

.how-to-jump-links {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 2rem 0;
}

.how-to-jump-links a {
    background: rgba(255, 255, 255, .68);
    border: 1px solid rgba(48, 66, 45, .14);
    border-radius: 999px;
    color: #496146;
    font-size: .88rem;
    font-weight: 700;
    padding: .5rem .8rem;
    text-decoration: none;
}

.how-to-grid {
    display: grid;
    gap: 1rem;
}

.how-to-card,
.how-to-examples,
.how-to-help {
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    padding: clamp(1.15rem, 3vw, 1.8rem);
}

.how-to-card-number {
    color: #a25934;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .14em;
    margin: 0 0 .45rem;
}

.how-to-card h2,
.how-to-card h3,
.how-to-example-grid h3 {
    font-family: Georgia, "Times New Roman", serif;
}

.how-to-card h2 {
    font-size: 1.65rem;
    margin: 0 0 .8rem;
}

.how-to-card h3 {
    color: #6f5318;
    font-size: 1.05rem;
    margin: 1.2rem 0 .35rem;
}

.how-to-card p,
.how-to-card li,
.how-to-help p,
.how-to-help li {
    line-height: 1.6;
}

.how-to-card ul,
.how-to-card ol,
.how-to-help ol {
    padding-left: 1.25rem;
}

.how-to-mini-example,
.how-to-balance-example,
.how-to-note {
    background: #f2f4eb;
    border-radius: .75rem;
    margin: 1rem 0;
    padding: .9rem 1rem;
}

.how-to-mini-example h3,
.how-to-mini-example p,
.how-to-note {
    margin-bottom: .35rem;
    margin-top: .35rem;
}

.how-to-result {
    color: #315b35;
}

.how-to-balance-example {
    display: grid;
    gap: .5rem;
}

.how-to-permission-grid,
.how-to-example-grid {
    display: grid;
    gap: .75rem;
}

.how-to-permission-grid > div {
    background: #f2f4eb;
    border-radius: .7rem;
    display: grid;
    gap: .25rem;
    padding: .85rem;
}

.how-to-permission-grid span {
    color: #657160;
    font-size: .9rem;
}

.how-to-two-column-copy {
    display: grid;
    gap: 1.5rem;
}

.how-to-examples,
.how-to-help {
    margin-top: 1rem;
}

.how-to-examples > h2,
.how-to-help > h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin: .25rem 0 1rem;
}

.how-to-example-grid article {
    background: #f2f4eb;
    border-radius: .8rem;
    padding: 1rem;
}

.how-to-example-grid h3 {
    margin: 0;
}

.how-to-example-grid dl {
    margin: .75rem 0;
}

.how-to-example-grid dl div {
    display: flex;
    justify-content: space-between;
}

.how-to-example-grid dd {
    font-weight: 750;
    margin: 0;
}

.how-to-help {
    background: #30422d;
    color: #f8f4e8;
}

.how-to-help .eyebrow {
    color: #efb98f;
}

@media (min-width: 48rem) {
    .how-to-grid,
    .how-to-example-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .how-to-card-wide {
        grid-column: 1 / -1;
    }

    .how-to-permission-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .how-to-two-column-copy {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =========================================================
   Buttons / Forms
   ========================================================= */

.field-group {
    display: grid;
    gap: .4rem;
    margin: 1rem 0;
}

.field-group label {
    font-size: .88rem;
    font-weight: 700;
}

.field-group input,
.field-group select,
.field-group textarea {
    background: #fff;
    border: 1px solid #aebaa9;
    border-radius: .65rem;
    color: #263a27;
    padding: .8rem .9rem;
    width: 100%;
}

.field-group textarea {
    min-height: 7rem;
    resize: vertical;
}

.field-group label span {
    color: #748070;
    font-weight: 400;
}

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

.primary-button,
.secondary-button,
.danger-button {
    border-radius: .65rem;
    cursor: pointer;
    display: inline-block;
    font-weight: 750;
    padding: .78rem 1rem;
    text-align: center;
    text-decoration: none;
}

.primary-button {
    background: #3f6545;
    border: 1px solid #3f6545;
    color: #fff;
    width: 100%;
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.secondary-button {
    background: transparent;
    border: 1px solid #58705a;
    color: #344f39;
    width: 100%;
}

.danger-button {
    background: transparent;
    border: 1px solid #a94e45;
    color: #8a312d;
}

.link-button {
    margin-top: .5rem;
}

.compact-action,
.compact-button {
    width: auto;
}

.compact-button {
    padding: .45rem .7rem;
}

/* =========================================================
   Login / Account
   ========================================================= */

.login-shell {
    margin: 0 auto;
    max-width: 32rem;
    width: 100%;
}

.account-card {
    background: rgba(255, 255, 255, .8);
    border: 1px solid rgba(48, 66, 45, .14);
    border-radius: 1.25rem;
    box-shadow: 0 1.25rem 4rem rgba(47, 63, 42, .1);
    padding: clamp(1.4rem, 5vw, 2.7rem);
}

.login-card {
    margin: 0 auto;
    max-width: 32rem;
    width: 100%;
}

.narrow-card {
    margin: 0 auto;
    max-width: 36rem;
    width: 100%;
}

.account-card h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 7vw, 3.75rem);
    letter-spacing: -.035em;
    margin: .25rem 0 .6rem;
}

.account-card h2,
.manage-content h2 {
    font-family: Georgia, "Times New Roman", serif;
}

.account-intro,
.account-help,
.password-guidance {
    color: #657160;
}

.account-help {
    font-size: .9rem;
    margin: 1.5rem 0 0;
}

.remember-row {
    align-items: center;
    display: flex;
    font-size: .88rem;
    gap: .55rem;
    margin: 1rem 0;
}

.sign-in-divider {
    align-items: center;
    color: #788275;
    display: flex;
    gap: 1rem;
    margin: .8rem 0;
}

.sign-in-divider::before,
.sign-in-divider::after {
    background: #d4dacd;
    content: "";
    flex: 1;
    height: 1px;
}

.setup-skip-form {
    margin-top: .75rem;
}

.settings-form {
    max-width: 34rem;
}

.passkey-list {
    display: grid;
    gap: .65rem;
    margin: 1.2rem 0;
}

.passkey-row {
    align-items: center;
    background: rgba(244, 246, 238, .85);
    border-radius: .7rem;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: .8rem;
}

.passkey-row form {
    display: flex;
    gap: .4rem;
}

.manage-shell {
    display: grid;
    gap: 1.25rem 2rem;
    grid-template-columns: minmax(10rem, 14rem) 1fr;
    width: 100%;
}

.manage-shell > header {
    grid-column: 1 / -1;
}

.manage-shell h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin: .15rem 0;
}

.manage-nav {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.manage-nav a {
    border-radius: .6rem;
    color: #42583f;
    padding: .7rem .8rem;
    text-decoration: none;
}

.manage-nav a.active {
    background: rgba(255, 255, 255, .75);
    color: #253d29;
    font-weight: 700;
}

.manage-content {
    background: rgba(255, 255, 255, .7);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    padding: clamp(1.2rem, 4vw, 2rem);
}

/* =========================================================
   Cottage Ledger
   ========================================================= */

.cottage-page {
    width: 100%;
}

.cottage-page h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.25rem, 6vw, 4.5rem);
    margin: .15rem 0;
}

.ledger-columns {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ledger-columns article {
    background: rgba(255, 255, 255, .76);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    min-height: 18rem;
    padding: 1.25rem;
}

.ledger-columns article > header {
    align-items: baseline;
    display: flex;
    gap: .8rem;
    justify-content: space-between;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    justify-content: flex-end;
}

.ledger-columns h2 {
    font-family: Georgia, "Times New Roman", serif;
    margin: 0;
}

.ledger-columns h3 {
    color: #795c13;
    font-size: .84rem;
    margin-bottom: .5rem;
    text-transform: uppercase;
}

.ledger-columns p,
.dashboard-list small {
    color: #6a7566;
}

.dashboard-list {
    display: grid;
    margin: 1rem 0;
}

.dashboard-list > a,
.dashboard-list > div {
    align-items: center;
    border-bottom: 1px solid #dce1d6;
    color: #30422d;
    display: flex;
    gap: .7rem;
    justify-content: space-between;
    padding: .7rem 0;
    text-decoration: none;
}

.dashboard-list span {
    display: grid;
}

.dashboard-list > a > strong,
.dashboard-list > div > strong {
    white-space: nowrap;
}

.balance-list {
    display: grid;
    gap: .6rem;
    margin: 1rem 0;
}

.balance-list div {
    background: #eef2e7;
    border-radius: .65rem;
    display: grid;
    padding: .7rem;
}

.balance-list span {
    color: #9a302b;
    font-weight: 750;
}

.pending-payment {
    background: #faf2d9;
    border-radius: .7rem;
    margin-bottom: .7rem;
    padding: .75rem;
}

.pending-payment p {
    margin-top: 0;
}

.pending-payment div {
    display: flex;
    gap: .4rem;
}

.cottage-page .compact-button {
    padding: .45rem .65rem;
}

.section-link {
    display: inline-block;
    margin-top: .5rem;
}

/* =========================================================
   Expenses / Payments / Ledgers
   ========================================================= */

.ledger-form-page {
    margin: 0 auto;
    max-width: 56rem;
    width: 100%;
}

.ledger-form-page h1,
.payment-form-page h1,
.expense-details-page h1,
.ledgers-page h1,
.personal-ledger-page h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.25rem, 6vw, 4rem);
    margin: .2rem 0;
}

.ledger-form,
.payment-form {
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    padding: clamp(1.1rem, 4vw, 2rem);
}

.allocation-fieldset {
    border: 0;
    margin: 1.5rem 0;
    padding: 0;
}

.allocation-fieldset legend,
.allocation-preview h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 700;
}

.allocation-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin: .7rem 0;
}

.allocation-modes label {
    align-items: center;
    display: flex;
    gap: .4rem;
}

.allocation-editors {
    display: grid;
    gap: .6rem;
}

.allocation-editor {
    align-items: center;
    background: #f4f6ee;
    border-radius: .7rem;
    display: grid;
    gap: .8rem;
    grid-template-columns: 1fr minmax(7rem, 10rem);
    padding: .75rem;
}

.allocation-editor > label {
    align-items: center;
    display: flex;
    gap: .7rem;
}

.allocation-editor span {
    display: grid;
}

.allocation-editor small {
    color: #6b7768;
}

.allocation-amount {
    border: 1px solid #aebaa9;
    border-radius: .55rem;
    padding: .6rem;
    width: 100%;
}

.fixed-remainder-editor {
    display: grid;
    gap: .45rem;
}

.fixed-remainder-editor select {
    border: 1px solid #aebaa9;
    border-radius: .55rem;
    padding: .6rem;
    width: 100%;
}

.read-only-fact,
.detail-note {
    background: #f4f6ee;
    border-radius: .7rem;
    margin: 1rem 0;
    padding: 1rem;
}

.read-only-fact {
    display: grid;
    gap: .25rem;
}

.read-only-fact span {
    color: #6b7768;
    font-size: .8rem;
    text-transform: uppercase;
}

.detail-note h2 {
    font-family: Georgia, "Times New Roman", serif;
    margin: 0 0 .5rem;
}

.detail-note p {
    margin: 0;
    white-space: pre-wrap;
}

.allocation-preview {
    background: #eef2e7;
    border-radius: .8rem;
    margin: 1.5rem 0;
    padding: 1rem;
}

.allocation-preview h2 {
    margin: 0 0 .6rem;
}

.allocation-preview dl {
    margin: 0;
}

.allocation-preview dl div,
.allocation-totals {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.allocation-preview dt,
.allocation-preview dd {
    margin: .25rem 0;
}

.allocation-totals {
    border-top: 1px solid #cbd4c3;
    flex-wrap: wrap;
    margin-top: .7rem;
    padding-top: .7rem;
}

.position.positive,
.effect.positive,
.allocation-preview .balanced {
    color: #2f6537;
}

.position.negative,
.effect.negative,
.allocation-preview .remaining {
    color: #9a302b;
}

.position.zero,
.effect.neutral {
    color: #687565;
}

.payment-form-page {
    margin: 0 auto;
    max-width: 44rem;
    width: 100%;
}

.direction-options {
    border: 0;
    margin: 0 0 1rem;
    padding: 0;
}

.direction-options legend {
    font-weight: 750;
    margin-bottom: .5rem;
}

.direction-options div {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.direction-options label {
    align-items: center;
    display: flex;
    gap: .4rem;
}

.expense-details-page {
    margin: 0 auto;
    max-width: 54rem;
    width: 100%;
}

.expense-lead {
    color: #5e6e5c;
    font-size: 1.15rem;
}

.expense-facts {
    display: grid;
    gap: .8rem;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    margin: 1.5rem 0;
}

.expense-facts div {
    background: rgba(255, 255, 255, .72);
    border-radius: .8rem;
    display: grid;
    gap: .25rem;
    padding: 1rem;
}

.expense-facts span {
    color: #6b7768;
    font-size: .8rem;
    text-transform: uppercase;
}

.allocation-card {
    background: rgba(255, 255, 255, .8);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.allocation-card h2 {
    font-family: Georgia, "Times New Roman", serif;
    margin-top: 0;
}

.allocation-card dl {
    margin: 0;
}

.allocation-card dl div {
    border-bottom: 1px solid #dce1d6;
    display: flex;
    justify-content: space-between;
    padding: .7rem 0;
}

.allocation-card dt,
.allocation-card dd {
    margin: 0;
}

.allocation-card dt {
    display: grid;
}

.allocation-card small,
.immutable-note {
    color: #6b7768;
}

.allocation-total {
    font-weight: 750;
}

.ledger-list-page,
.payments-page,
.ledgers-page,
.personal-ledger-page {
    width: 100%;
}

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

.ledger-page-header h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.25rem, 6vw, 4rem);
    margin: .2rem 0 0;
}

.transaction-list {
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    overflow: hidden;
}

.transaction-row {
    align-items: center;
    border-bottom: 1px solid rgba(48, 66, 45, .12);
    color: #30422d;
    display: grid;
    gap: 1rem;
    grid-template-columns: 9rem 1fr auto;
    padding: 1rem;
    text-decoration: none;
}

.transaction-row:last-child {
    border-bottom: 0;
}

.transaction-row:hover {
    background: rgba(238, 242, 231, .8);
}

.transaction-row span:nth-child(2) {
    display: grid;
    gap: .2rem;
}

.transaction-row small,
.transaction-date {
    color: #687565;
}

.transaction-amount {
    display: grid;
    gap: .15rem;
    text-align: right;
    white-space: nowrap;
}

.transaction-amount small {
    font-size: .72rem;
    font-weight: 500;
}

.adjustment-history-item {
    border-top: 1px solid #dce1d6;
    padding: 1rem 0;
}

.adjustment-history-item:first-of-type {
    border-top: 0;
}

.adjustment-history-item > div {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.adjustment-history-item > small {
    display: block;
    margin-top: .3rem;
}

.adjustment-history-item details {
    margin-top: .75rem;
}

.correction-summary,
.correction-summary + .ledger-form {
    margin-top: 1rem;
}

.field-group output {
    background: rgba(255, 255, 255, .8);
    border: 1px solid #cdd5c7;
    border-radius: .55rem;
    min-height: 2.7rem;
    padding: .7rem .75rem;
}

.empty-card {
    background: rgba(255, 255, 255, .75);
    border-radius: 1rem;
    padding: 2rem;
}

.empty-card h2 {
    font-family: Georgia, "Times New Roman", serif;
    margin-top: 0;
}

.ledger-user-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    margin-top: 1.5rem;
}

.ledger-user-grid a {
    align-items: center;
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: .9rem;
    color: #30422d;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem;
    text-decoration: none;
}

.ledger-user-grid a:hover {
    background: #f5f7f0;
}

.ledger-user-grid a > span:first-child {
    display: grid;
}

.ledger-user-grid small {
    color: #687565;
}

.position {
    font-size: .85rem;
    font-weight: 750;
    text-align: right;
}

.pending-section,
.payment-history {
    background: rgba(255, 255, 255, .76);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    margin-bottom: 1rem;
    padding: 1.25rem;
}

.pending-section h2,
.payment-history h2 {
    font-family: Georgia, "Times New Roman", serif;
    margin-top: 0;
}

.pending-card {
    align-items: center;
    background: #eef2e7;
    border-radius: .75rem;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: .6rem;
    padding: .9rem;
}

.pending-card > div:first-child {
    display: grid;
    gap: .25rem;
}

.pending-card span,
.payment-list small,
.payment-date {
    color: #687565;
}

.payment-actions {
    display: flex;
    gap: .5rem;
}

.payment-list article {
    align-items: center;
    border-bottom: 1px solid #dce1d6;
    display: grid;
    gap: .8rem;
    grid-template-columns: 8rem 1fr auto auto;
    padding: .8rem 0;
}

.payment-list article:last-child {
    border-bottom: 0;
}

.payment-list article > span:nth-child(2) {
    display: grid;
}

.payment-delete-control {
    grid-column: 1 / -1;
}

.transaction-delete-confirmation {
    background: #fff8f6;
    border: 1px solid rgba(169, 78, 69, .35);
    border-radius: .75rem;
    display: grid;
    gap: .65rem;
    padding: 1rem;
}

.transaction-delete-confirmation h2,
.transaction-delete-confirmation h3,
.transaction-delete-confirmation p {
    margin: 0;
}

.transaction-delete-confirmation .payment-actions {
    flex-wrap: wrap;
}

.payments-page .status-pill {
    font-size: .76rem;
}

.ledger-identity,
.history-heading span {
    color: #657160;
}

.ledger-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 1rem 0;
}

.summary-card,
.counterparty-card,
.history-card {
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    margin-top: 1rem;
    padding: 1.25rem;
}

.summary-card h2,
.counterparty-card h2,
.history-card h2 {
    font-family: Georgia, "Times New Roman", serif;
    margin-top: 0;
}

.summary-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-grid div {
    background: #f2f5ed;
    border-radius: .7rem;
    display: grid;
    gap: .25rem;
    padding: .9rem;
}

.summary-grid span {
    color: #687565;
    font-size: .8rem;
    text-transform: uppercase;
}

.summary-grid .net {
    background: #e8eee2;
}

.counterparty-card > div {
    border-top: 1px solid #dce1d6;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: .75rem 0;
}

.history-heading {
    align-items: baseline;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.history-list article {
    align-items: center;
    border-top: 1px solid #dce1d6;
    display: grid;
    gap: .7rem;
    grid-template-columns: 8rem 1fr auto auto auto;
    padding: .8rem 0;
}

.entry-description {
    display: grid;
}

.entry-description small,
.entry-date,
.running {
    color: #687565;
}

.effect {
    font-size: .84rem;
    font-weight: 750;
}

.running {
    font-size: .82rem;
}

/* =========================================================
   Administration
   ========================================================= */

.admin-form-page {
    margin: 0 auto;
    max-width: 58rem;
    width: 100%;
}

.admin-form-page h1,
.admin-page-header h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.25rem, 6vw, 4rem);
}

.admin-form-page h1 {
    margin: .2rem 0 1.25rem;
}

.admin-user-form {
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: 1rem;
    padding: clamp(1.25rem, 4vw, 2rem);
}

.admin-toggle {
    align-items: start;
    display: grid;
    gap: .7rem;
    grid-template-columns: auto 1fr;
    margin: 1rem 0;
}

.admin-toggle input {
    height: 1.15rem;
    margin-top: .15rem;
    width: 1.15rem;
}

.admin-toggle span,
.admin-toggle small {
    display: block;
}

.admin-toggle small,
.admin-form-page .form-note {
    color: #687565;
}

.permission-fieldset {
    border: 0;
    margin: 1.5rem 0;
    padding: 0;
}

.permission-fieldset legend,
.reset-access-section h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: .75rem;
}

.admin-completion-actions {
    display: flex;
    gap: .75rem;
}

.admin-completion-actions a {
    width: auto;
}

.user-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1.25rem;
    margin-bottom: 1rem;
}

.reset-access-section {
    background: rgba(255, 255, 255, .6);
    border: 1px solid rgba(48, 66, 45, .13);
    border-radius: .8rem;
    margin: 1rem 0;
    padding: 1.25rem;
}

.reset-access-section h2 {
    margin-top: 0;
}

.admin-users-page {
    width: 100%;
}

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

.admin-page-header h1 {
    margin: .2rem 0 0;
}

.admin-create-link {
    width: auto;
}

.user-table-wrap {
    overflow-x: auto;
}

.user-table {
    background: rgba(255, 255, 255, .78);
    border-collapse: collapse;
    border-radius: .8rem;
    overflow: hidden;
    width: 100%;
}

.user-table th,
.user-table td {
    border-bottom: 1px solid rgba(48, 66, 45, .12);
    padding: .8rem;
    text-align: left;
    vertical-align: top;
}

.user-table th {
    background: rgba(231, 236, 222, .9);
    font-size: .78rem;
    letter-spacing: .03em;
}

.permission-summary {
    color: #62705f;
    font-size: .86rem;
    min-width: 12rem;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: .78rem;
    font-weight: 750;
    padding: .25rem .55rem;
}

.status-pill.active,
.status-pill.confirmed {
    background: #e1efe1;
    color: #2d6236;
}

.status-pill.disabled,
.status-pill.rejected,
.status-pill.reversed {
    background: #f3dddd;
    color: #8a302d;
}

.status-pill.pending {
    background: #f5eccf;
    color: #795c13;
}

.permission-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-option {
    align-items: start;
    background: rgba(244, 246, 238, .86);
    border: 1px solid rgba(48, 66, 45, .12);
    border-radius: .7rem;
    display: grid;
    gap: .7rem;
    grid-template-columns: auto 1fr;
    padding: .85rem;
}

.permission-option input {
    height: 1.15rem;
    margin-top: .15rem;
    width: 1.15rem;
}

.permission-option span,
.permission-option small {
    display: block;
}

.permission-option small {
    color: #687565;
    line-height: 1.35;
    margin-top: .2rem;
}

.temporary-access-card {
    background: #fff8e6;
    border: 1px solid #d8b76d;
    border-radius: .9rem;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
}

.temporary-access-card h2 {
    font-family: Georgia, "Times New Roman", serif;
    margin: .25rem 0 1rem;
}

.temporary-access-card code {
    background: #fff;
    border: 1px solid #ded5bd;
    border-radius: .35rem;
    color: #263a27;
    display: inline-block;
    font-size: 1rem;
    padding: .25rem .4rem;
    user-select: all;
}

.temporary-access-card .secondary-button {
    width: auto;
}

.credential-warning {
    color: #8a4b27;
    font-weight: 700;
    margin-bottom: 0;
}

.admin-logs-page {
    min-width: 0;
}

.admin-logs-header {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.admin-logs-header h1,
.admin-logs-header p {
    margin-bottom: .35rem;
}

.admin-logs-header .admin-log-time-zone {
    color: #496146;
    font-size: .9rem;
    margin-bottom: 0;
}

.admin-log-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
}

.copy-status {
    color: #496146;
    min-width: 4rem;
}

.admin-log-content {
    background: #fff;
    border: 1px solid rgba(48, 66, 45, .28);
    border-radius: .4rem;
    box-sizing: border-box;
    color: #172217;
    font-family: Consolas, "Courier New", monospace;
    font-size: .82rem;
    height: min(70vh, 52rem);
    line-height: 1.45;
    overflow: auto;
    padding: .85rem;
    resize: vertical;
    white-space: pre;
    width: 100%;
}

/* =========================================================
   Status / Errors / Messages
   ========================================================= */

.status-message {
    border-radius: .55rem;
    margin: 1rem 0;
    padding: .75rem .9rem;
}

.status-message.error,
.validation-message {
    color: #9a302b;
}

.status-message.error {
    background: #f8e5e2;
}

.status-message.success {
    background: #e4f1e4;
    color: #2f6537;
}

.validation-message ul {
    padding-left: 1.25rem;
}

.blazor-error-boundary {
    background: #8f2e25;
    color: #fff;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    box-sizing: border-box;
    color-scheme: light only;
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .5rem;
}

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

#components-reconnect-modal {
    animation: components-reconnect-modal-fadeOutOpacity .5s both;
    background-color: #fff;
    border: 0;
    border-radius: .5rem;
    box-shadow: 0 3px 6px 2px rgba(0, 0, 0, .3);
    margin: 20vh auto;
    opacity: 0;
    padding: 2rem;
    transition: display .5s allow-discrete, overlay .5s allow-discrete;
    width: 20rem;
}

#components-reconnect-modal[open] {
    animation: components-reconnect-modal-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) .3s, components-reconnect-modal-fadeInOpacity .5s ease-in-out .3s;
    animation-fill-mode: both;
}

#components-reconnect-modal::backdrop {
    animation: components-reconnect-modal-fadeInOpacity .5s ease-in-out;
    background-color: rgba(0, 0, 0, .4);
    opacity: 1;
}

.components-reconnect-container {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#components-reconnect-modal p {
    margin: 0;
    text-align: center;
}

#components-reconnect-modal button {
    background-color: #6b9ed2;
    border: 0;
    border-radius: 4px;
    color: #fff;
    padding: 4px 24px;
}

#components-reconnect-modal button:hover {
    background-color: #3b6ea2;
}

#components-reconnect-modal button:active {
    background-color: #6b9ed2;
}

.components-rejoining-animation {
    height: 80px;
    position: relative;
    width: 80px;
}

.components-rejoining-animation div {
    animation: components-rejoining-animation 1.5s cubic-bezier(0, .2, .8, 1) infinite;
    border: 3px solid #0087ff;
    border-radius: 50%;
    opacity: 1;
    position: absolute;
}

.components-rejoining-animation div:nth-child(2) {
    animation-delay: -.5s;
}

@keyframes components-reconnect-modal-slideUp {
    0% {
        transform: translateY(30px) scale(.95);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes components-reconnect-modal-fadeInOpacity {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes components-reconnect-modal-fadeOutOpacity {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes components-rejoining-animation {
    0%,
    4.9% {
        height: 0;
        left: 40px;
        opacity: 0;
        top: 40px;
        width: 0;
    }

    5% {
        height: 0;
        left: 40px;
        opacity: 1;
        top: 40px;
        width: 0;
    }

    100% {
        height: 80px;
        left: 0;
        opacity: 0;
        top: 0;
        width: 80px;
    }
}

/* =========================================================
   Responsive
   ========================================================= */

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

    .ledger-columns article {
        min-height: 9rem;
    }
}

@media (max-width: 55rem) {
    .history-list article {
        grid-template-columns: 1fr auto;
    }

    .entry-date {
        grid-column: 1 / -1;
    }
}

@media (max-width: 52rem) {
    .user-table thead {
        display: none;
    }

    .user-table,
    .user-table tbody,
    .user-table tr,
    .user-table td {
        display: block;
    }

    .user-table tr {
        border-bottom: 1px solid rgba(48, 66, 45, .2);
        padding: .65rem;
    }

    .user-table td {
        border: 0;
        display: grid;
        gap: .75rem;
        grid-template-columns: 9rem 1fr;
        padding: .4rem;
    }

    .user-table td::before {
        color: #697565;
        content: attr(data-label);
        font-size: .76rem;
        font-weight: 750;
    }
}

@media (max-width: 43rem) {
    .app-header {
        grid-template-columns: 1fr auto;
    }

    .primary-nav {
        grid-column: 1;
        grid-row: 2;
    }

    .account-actions {
        flex-wrap: wrap;
        gap: .65rem;
        justify-content: end;
    }

    .display-name {
        flex-basis: 100%;
        text-align: right;
    }

    .permission-grid {
        grid-template-columns: 1fr;
    }

    .admin-logs-header {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 42rem) {
    .manage-shell {
        grid-template-columns: 1fr;
    }

    .manage-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .payments-page .ledger-page-header,
    .pending-card {
        align-items: stretch;
        flex-direction: column;
    }

    .payment-list article {
        grid-template-columns: 1fr auto;
    }

    .payment-date {
        grid-column: 1 / -1;
    }
}

@media (max-width: 40rem) {
    .ledger-list-page .ledger-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .transaction-row {
        grid-template-columns: 1fr auto;
    }

    .transaction-date {
        grid-column: 1 / -1;
    }
}

@media (max-width: 38rem) {
    .form-grid,
    .allocation-editor,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .counterparty-card > div,
    .history-heading {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 35rem) {
    .passkey-row,
    .admin-completion-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-completion-actions a {
        width: 100%;
    }
}

@media (max-width: 34rem) {
    .admin-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .user-table td {
        gap: .15rem;
        grid-template-columns: 1fr;
    }
}
