/**
 * ============================================================================
 * Twin Hills Water District Billing Portal
 * File: assets/app.css
 * ============================================================================
 *
 * PURPOSE
 * -------
 * Portal layout, district header/footer chrome, development banner,
 * snackbar, and shared interactive controls. Page-specific styles will
 * grow here as P-100+ screens are built.
 *
 * Brand tokens follow the design specification §5.
 */

:root {
    --bill-text: #393A3D;
    --bill-heading: #242424;
    --bill-muted: #6b7280;
    --bill-link: #1268C4;
    --bill-table-header: #373737;
    --bill-button: #2F5F8F;
    --bill-button-hover: #264F77;
    --bill-ledger-invoice: #2F5F8F;
    --bill-ledger-payment: #1f7a45;
    --bill-footer-bg: #393A3D;
    --bill-border: #d5d5d5;
    --bill-panel-bg: #ffffff;
    --bill-page-bg: #f3f5f7;
    --bill-dev-bg: #f0a202;
    --bill-radius: 8px;
    --bill-radius-sm: 6px;
    --bill-font-serif: Georgia, "Times New Roman", serif;
    --bill-font-sans: Verdana, Geneva, sans-serif;
    --bill-header-height: 5.5rem;
    --bill-max-width: 72rem;
}

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

html {
    scroll-behavior: smooth;
}

body.bill-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #eef2f5 0%, var(--bill-page-bg) 40%, #e8edf1 100%);
    color: var(--bill-text);
    font-family: var(--bill-font-sans);
    font-size: 14px;
    line-height: 1.5;
}

body.bill-body--dev {
    padding-top: 2.25rem;
}

.bill-skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 10000;
    padding: 0.75rem 1rem;
    background: #000;
    color: #fff;
}

.bill-skip-link:focus {
    left: 0.75rem;
    top: 0.75rem;
}

/* Development banner */

.bill-dev-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    padding: 0.45rem 1rem;
    background: var(--bill-dev-bg);
    color: #1a1a1a;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
}

/* Site header — centered title, centered nav row below */

.thwd-site-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: #fff;
    border-bottom: 1px solid var(--bill-border);
}

body.bill-body--dev .thwd-site-header {
    top: 2.25rem;
}

.thwd-site-header__inner {
    width: min(100% - 2rem, var(--bill-max-width));
    margin: 0 auto;
    padding: 1rem 0 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.thwd-site-header__brand-row {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thwd-site-header__brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--bill-heading);
    text-align: center;
}

.thwd-site-header__logo {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.thwd-site-header__title {
    font-family: var(--bill-font-serif);
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.2;
}

.thwd-site-header__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem 1.35rem;
    width: 100%;
    padding: 0.15rem 0 0.35rem;
}

.thwd-site-header__link {
    font-family: var(--bill-font-sans);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--bill-heading);
    white-space: nowrap;
}

.thwd-site-header__link:hover,
.thwd-site-header__link:focus,
.thwd-site-header__link--active {
    color: var(--bill-link);
    text-decoration: underline;
}

.thwd-site-header__toggle {
    display: none;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--bill-border);
    background: #fff;
    cursor: pointer;
    font: inherit;
}

.thwd-site-header__toggle-line {
    display: block;
    width: 1.15rem;
    height: 2px;
    background: var(--bill-heading);
}

.thwd-site-header__toggle-line + .thwd-site-header__toggle-line {
    margin-top: 4px;
}

/* Main content */

.bill-main {
    width: min(100% - 2rem, 48rem);
    margin: 1.75rem auto 3rem;
    flex: 1 0 auto;
}

.bill-panel {
    position: relative;
    background: var(--bill-panel-bg);
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius);
    padding: 1.5rem 1.35rem;
}

.bill-panel:has(.bill-print) {
    padding-right: 2.75rem;
}

.bill-print {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: var(--bill-radius-sm);
    background: transparent;
    color: var(--bill-muted);
    font-size: 0.95rem;
    cursor: pointer;
    opacity: 0.65;
}

.bill-print:hover,
.bill-print:focus-visible {
    opacity: 1;
    color: var(--bill-heading);
    background: rgba(0, 0, 0, 0.04);
    outline: none;
}

.bill-selected-total {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.5rem;
    margin: 1.1rem 0 0;
    font-size: 1.05rem;
}

.bill-selected-total strong {
    font-size: 1.15rem;
    color: var(--bill-heading);
}

.bill-panel h1 {
    margin: 0 0 0.75rem;
    font-family: var(--bill-font-serif);
    font-size: 22px;
    font-weight: 400;
    color: var(--bill-heading);
}

.bill-panel p {
    margin: 0 0 1rem;
}

.bill-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.bill-button {
    display: inline-block;
    padding: 0.75rem 1.15rem;
    min-height: 44px;
    border: 0;
    border-radius: var(--bill-radius-sm);
    background: var(--bill-button);
    color: #fff;
    font-family: var(--bill-font-sans);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.bill-button:hover,
.bill-button:focus {
    background: var(--bill-button-hover);
    color: #fff;
    text-decoration: none;
}

.bill-button:disabled,
.bill-button:disabled:hover,
.bill-button:disabled:focus,
.bill-button[aria-disabled="true"],
.bill-button[aria-disabled="true"]:hover,
.bill-button[aria-disabled="true"]:focus,
.bill-button.is-processing,
.bill-button.is-processing:hover,
.bill-button.is-processing:focus {
    background: #9aa7b5;
    color: #f3f5f7;
    opacity: 1;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

.bill-paypal.is-processing,
.bill-ach-form.is-processing {
    opacity: 0.72;
    pointer-events: none;
}

.bill-paypal.is-processing .bill-button,
.bill-ach-form.is-processing .bill-button {
    background: #9aa7b5;
    color: #f3f5f7;
    cursor: not-allowed;
}

.bill-button--secondary {
    background: #fff;
    color: var(--bill-button);
    border: 1px solid var(--bill-button);
}

.bill-button--secondary:hover,
.bill-button--secondary:focus {
    background: #f5f8fb;
    color: var(--bill-button-hover);
}

.bill-button[hidden] {
    display: none !important;
}

.bill-partial-payment-form {
    display: none !important;
}

a {
    color: var(--bill-link);
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

/* Snackbar (session expired, etc.) */

.bill-snackbar {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    z-index: 10002;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: min(100% - 2rem, 28rem);
    padding: 0.9rem 1rem;
    border-radius: var(--bill-radius);
    background: #1f2a33;
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.bill-snackbar__message {
    margin: 0;
    flex: 1;
}

.bill-snackbar__dismiss {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

.bill-snackbar.is-hidden {
    display: none;
}

/* Footer */

.bill-footer {
    margin-top: auto;
    background: var(--bill-footer-bg);
    color: #f5f5f5;
}

.bill-footer__inner {
    width: min(100% - 2rem, var(--bill-max-width));
    margin: 0 auto;
    padding: 0.75rem 0;
    text-align: center;
    line-height: 1.25;
}

.bill-footer__org,
.bill-footer__line,
.bill-footer__copy {
    margin: 0;
}

.bill-footer__org {
    margin-bottom: 0.15rem;
}

.bill-footer__copy {
    margin-top: 0.4rem;
    opacity: 0.9;
}

/* Mobile navigation */

@media (max-width: 900px) {
    .thwd-site-header {
        position: sticky;
    }

    .thwd-site-header__inner {
        position: relative;
        padding-bottom: 0.85rem;
    }

    .thwd-site-header__brand-row {
        min-height: 3.5rem;
        padding-right: 5.5rem;
    }

    .thwd-site-header__toggle {
        display: inline-flex;
        flex-direction: column;
        border-radius: var(--bill-radius-sm);
    }

    .thwd-site-header__nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        width: 100%;
        padding: 0.25rem 0 0.4rem;
        border-top: 1px solid var(--bill-border);
    }

    .thwd-site-header__nav.is-open {
        display: flex;
    }

    .thwd-site-header__link {
        display: block;
        width: 100%;
        padding: 0.4rem 0.25rem;
        text-align: center;
        line-height: 1.2;
    }

    .thwd-site-header__title {
        font-size: 18px;
    }
}

/* Portal P-100 */

.bill-portal h1,
.bill-panel h1 {
    margin: 0 0 0.75rem;
    font-family: var(--bill-font-serif);
    font-size: 22px;
    font-weight: 400;
    color: var(--bill-heading);
}

.bill-portal__intro {
    margin: 0 0 1.25rem;
}

.bill-actions-grid {
    display: grid;
    gap: 0.85rem;
    margin: 1.25rem 0;
}

.bill-action-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "icon title"
        "icon help";
    gap: 0.15rem 0.85rem;
    width: 100%;
    padding: 1rem 1.1rem;
    border: 1px solid #9eb6cc;
    border-radius: var(--bill-radius);
    background: #2F5F8F;
    color: #fff;
    text-align: left;
    cursor: pointer;
    font: inherit;
    min-height: 88px;
}

.bill-action-panel:hover,
.bill-action-panel:focus {
    background: #264F77;
    outline: 2px solid #1268C4;
    outline-offset: 2px;
}

.bill-action-panel.is-selected {
    background: #1f7a45;
    border-color: #7eb892;
    outline: 2px solid #2ea043;
    outline-offset: 2px;
}

.bill-action-panel.is-selected:hover,
.bill-action-panel.is-selected:focus {
    background: #186338;
    outline-color: #2ea043;
}

.bill-action-panel__icon {
    grid-area: icon;
    font-size: 1.4rem;
    align-self: center;
}

.bill-action-panel__title {
    grid-area: title;
    font-weight: 700;
    font-size: 16px;
}

.bill-action-panel__help {
    grid-area: help;
    font-size: 13px;
    opacity: 0.95;
}

.bill-lookup {
    margin: 1rem 0 1.5rem;
    padding: 1.1rem;
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius);
    background: #fff;
}

.bill-form .bill-field {
    margin-bottom: 1rem;
}

.bill-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.bill-form input[type="text"],
.bill-form input[type="email"],
.bill-form input[type="number"],
.bill-form input[type="password"] {
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    border: 1px solid #9aa3ab;
    border-radius: var(--bill-radius-sm);
    font: inherit;
}

.bill-info-card {
    margin: 1.25rem 0;
    padding: 1.1rem;
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius);
    background: #f8fafc;
}

.bill-info-card h2 {
    margin: 0 0 0.5rem;
    font-family: var(--bill-font-serif);
    font-size: 18px;
    font-weight: 400;
    color: var(--bill-heading);
}

.bill-info-card--fees .bill-fees-table-wrap {
    margin-top: 0.85rem;
}

.bill-fees-card__help {
    margin: 1rem 0 0;
}

.bill-fees-card__help a {
    font-weight: 600;
}

.bill-fees-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

.bill-fees-table th,
.bill-fees-table td {
    vertical-align: top;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--bill-border);
    color: var(--bill-text, #393a3d);
}

.bill-fees-table th {
    text-align: left;
    background: #2F5F8F;
    color: #fff;
    font-weight: 700;
}

.bill-fees-table td:first-child {
    width: 42%;
    font-weight: 600;
}

.bill-fees-table a {
    color: var(--bill-link);
}

.bill-fees-table__rate-lines {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bill-fees-table__rate-lines li + li {
    margin-top: 0.35rem;
}

@media screen and (max-width: 650px) {
    .bill-fees-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    .bill-fees-table,
    .bill-fees-table tbody,
    .bill-fees-table tr,
    .bill-fees-table td {
        display: block;
        width: 100%;
    }

    .bill-fees-table tr {
        margin: 0 0 0.85rem 0;
        border: 1px solid var(--bill-border);
        background: #fff;
    }

    .bill-fees-table td {
        border: 0;
        padding: 0.55rem 0.85rem;
    }

    .bill-fees-table td:first-child {
        width: 100%;
        padding-bottom: 0.2rem;
        background: #f4f6f8;
        border-bottom: 1px solid #e4e7ea;
    }

    .bill-fees-table td:last-child {
        padding-top: 0.45rem;
        padding-bottom: 0.75rem;
    }

    .bill-fees-table td:last-child::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.2rem;
        font-size: 0.8rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        color: #5c656d;
    }
}

.bill-alert {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid #a94442;
    border-radius: var(--bill-radius-sm);
    background: #f8e8e8;
}

.bill-alert__message {
    margin: 0;
}

.bill-debug {
    margin: 0.75rem 0 0;
    padding: 0.65rem 0.75rem;
    border: 1px dashed #9a6b6b;
    border-radius: var(--bill-radius-sm);
    background: #2b2121;
    color: #f6dede;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.bill-banner {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--bill-radius-sm);
    font-weight: 700;
}

.bill-banner--success {
    background: #e5f4ea;
    border-left: 4px solid #2e7d4f;
    color: #1e5a38;
}

.bill-banner--warning {
    background: #fff4e5;
    border-left: 4px solid #c47d12;
    color: #7a4b00;
}

.bill-main--wide {
    width: min(100% - 2rem, 56rem);
}

.bill-back {
    margin: 0 0 0.75rem;
}

.bill-meta {
    display: grid;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

@media (min-width: 720px) {
    .bill-meta {
        grid-template-columns: 1.2fr 1fr;
    }
}

.bill-dl {
    margin: 0;
}

.bill-dl > div {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.4rem;
    align-items: center;
}

.bill-dl dt {
    margin: 0;
    font-weight: 700;
}

.bill-dl dd {
    margin: 0;
}

.bill-status {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: var(--bill-radius-sm);
    font-weight: 600;
    line-height: 1.35;
}

.bill-status--overdue {
    background: #f8e8e8;
    color: #8a2f2f;
}

.bill-status--paid {
    background: #e5f4ea;
    color: #1e5a38;
}

.bill-status--partial {
    background: #fff4e5;
    color: #7a4b00;
}

.bill-status--open {
    background: #eef5fb;
    color: #2f5f8f;
}

.bill-status--muted {
    background: #f3f4f6;
    color: #5c656d;
}

.bill-notices {
    display: grid;
    gap: 0.65rem;
    margin: 0 0 1.5rem;
}

.bill-notice {
    padding: 0.75rem 0.9rem;
    border-radius: var(--bill-radius-sm);
    border-left: 4px solid #2f5f8f;
    background: #f4f7fa;
}

.bill-notice--warning {
    background: #fff4e5;
    border-left-color: #c47d12;
}

.bill-notice__label {
    display: block;
    font-weight: 700;
}

.bill-notice__detail {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--bill-muted);
}

.bill-balance {
    margin: 1.25rem 0;
    padding: 1rem;
    background: #eef5fb;
    border: 1px solid #c5d7e8;
    border-radius: var(--bill-radius);
    text-align: center;
}

.bill-balance__label {
    display: block;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bill-balance__scope {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.9rem;
    color: var(--bill-muted, #5c656d);
}

.bill-balance__value {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--bill-heading);
}

.bill-table-wrap {
    overflow-x: auto;
    margin: 1rem 0;
}

.bill-table {
    width: 100%;
    border-collapse: collapse;
}

.bill-table th {
    background: var(--bill-table-header);
    color: #fff;
    text-align: left;
    padding: 0.65rem 0.7rem;
}

.bill-table td {
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid var(--bill-border);
    vertical-align: top;
}

.bill-expand-row {
    cursor: pointer;
}

.bill-expand-caret {
    display: inline-block;
    width: 0.45em;
    height: 0.45em;
    margin-right: 0.5em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    vertical-align: 0.12em;
}

.bill-expand-row[aria-expanded="true"] .bill-expand-caret {
    transform: rotate(45deg);
    vertical-align: 0.2em;
}

.bill-expand-row:focus-visible {
    outline: 2px solid var(--bill-link);
    outline-offset: 2px;
}

.bill-expand {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}

.bill-expand:hover,
.bill-expand:focus {
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-decoration: none;
}

.bill-expand:focus-visible {
    outline: 2px solid var(--bill-link);
    outline-offset: 2px;
}

/* Keep a comfortable tap target on mobile cards without shifting table rows. */
.bill-card .bill-expand {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.bill-table .bill-expand {
    display: inline;
    min-height: 0;
    vertical-align: baseline;
}

.bill-table td .bill-invoice-detail[hidden] {
    display: none !important;
    margin: 0;
    padding: 0;
}

.bill-invoice-detail {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-left: 3px solid #bbb;
    background: #fafafa;
}

.bill-detail-lines {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.bill-detail-lines li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
    align-items: flex-start;
}

.bill-detail-line-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.bill-detail-line-desc,
.bill-detail-notes {
    color: var(--bill-muted);
    font-weight: 400;
}

.bill-detail-line-desc {
    font-size: 0.85em;
}

.bill-detail-label {
    margin: 0 0 0.25rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.bill-detail-notes {
    white-space: pre-wrap;
    margin: 0.5rem 0 0;
}

.bill-table--ledger .bill-ledger-row--invoice td.bill-ledger-leftdue {
    font-weight: 700;
}

.bill-methods {
    border: 0;
    margin: 1rem 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.bill-method {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1.1rem;
    border: 1px solid #9eb6cc;
    border-radius: var(--bill-radius);
    background: #2F5F8F;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 16px;
}

.bill-method input[type="radio"] {
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: #fff;
}

.bill-method:hover,
.bill-method:focus-within {
    background: #264F77;
    outline: 2px solid #1268C4;
    outline-offset: 2px;
}

.bill-method.is-selected,
.bill-method:has(input:checked) {
    background: #1f7a45;
    border-color: #7eb892;
    outline: 2px solid #2ea043;
    outline-offset: 2px;
}

.bill-method.is-selected:hover,
.bill-method.is-selected:focus-within,
.bill-method:has(input:checked):hover,
.bill-method:has(input:checked):focus-within {
    background: #186338;
    outline-color: #2ea043;
}

.bill-fee-box {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius);
    background: #fff;
}

.bill-fee-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.55rem;
}

.bill-fee-row--total {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bill-border);
    font-size: 1.05rem;
}

.bill-check-instructions__title {
    margin: 0 0 0.75rem;
    font-family: var(--bill-font-serif);
    font-size: 1.05rem;
    font-weight: 700;
}

.bill-check-instructions__body {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bill-border);
}

.bill-check-instructions__line {
    margin: 0 0 0.85rem;
    line-height: 1.5;
}

.bill-check-instructions__line:last-of-type {
    margin-bottom: 0;
}

.bill-check-instructions__note {
    margin: 0.85rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--bill-border);
    color: #4a5560;
    font-size: 14px;
    line-height: 1.5;
}

.bill-tooltip-btn {
    width: 1.5rem;
    height: 1.5rem;
    margin-left: 0.35rem;
    border: 1px solid #777;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    vertical-align: middle;
    line-height: 1;
}

.bill-tooltip {
    display: block;
    margin-top: 0.5rem;
    max-width: 22rem;
    padding: 0.65rem 0.75rem;
    background: #1f2a33;
    color: #fff;
    font-size: 13px;
    border-radius: var(--bill-radius-sm);
}

.bill-tooltip[hidden] {
    display: none !important;
}

.bill-tooltip--wide {
    max-width: 28rem;
}

.bill-tooltip__para {
    margin: 0 0 0.65rem;
}

.bill-tooltip__para:last-child {
    margin-bottom: 0;
}

.bill-tooltip__para--title {
    font-weight: 700;
}

.bill-paperless {
    margin: 1rem 0 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius-sm);
    background: #f8fafb;
}

.bill-paperless__row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.bill-paperless__checkbox {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    flex: 0 0 auto;
}

.bill-paperless__label {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin: 0;
    font-weight: 600;
}

.bill-paperless__note {
    margin: 0.55rem 0 0;
}

.bill-paperless.is-saving {
    opacity: 0.75;
}

.bill-paperless.is-saving .bill-paperless__checkbox {
    cursor: wait;
}

.bill-field--checkbox {
    margin-bottom: 1rem;
}

.bill-check-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.bill-alert--success {
    background: #eef8f0;
    border-color: #b8dfc2;
}

.bill-sync-summary {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

.bill-footer__staff {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
}

.bill-footer__staff a {
    color: inherit;
}

.bill-form--sync {
    max-width: 28rem;
    margin-top: 1.25rem;
}

.bill-admin-menu {
    display: grid;
    gap: 0.85rem;
    margin: 1.25rem 0;
}

.bill-admin-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "icon title"
        "icon help";
    gap: 0.15rem 0.85rem;
    padding: 1rem 1.1rem;
    border: 1px solid #9eb6cc;
    border-radius: var(--bill-radius);
    background: #2F5F8F;
    color: #fff;
    text-decoration: none;
    min-height: 88px;
}

.bill-admin-card:hover,
.bill-admin-card:focus {
    background: #264F77;
    outline: 2px solid #1268C4;
    outline-offset: 2px;
    color: #fff;
    text-decoration: none;
}

.bill-admin-card__icon {
    grid-area: icon;
    font-size: 1.4rem;
    align-self: center;
}

.bill-admin-card__title {
    grid-area: title;
    font-weight: 700;
    font-size: 16px;
}

.bill-admin-card__help {
    grid-area: help;
    font-size: 14px;
    line-height: 1.4;
}

.bill-admin-logout {
    margin-top: 1rem;
}

.bill-paypal-field {
    box-sizing: border-box;
    margin-bottom: 0.75rem;
    width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    overflow: hidden;
    border: 1px solid #9aa3ab;
    border-radius: var(--bill-radius-sm);
    background: #fff;
}

/* PayPal v6 card field custom elements fill their parent. */
.bill-paypal-field > * {
    display: block;
    box-sizing: border-box;
    width: 100% !important;
    height: 44px !important;
    max-height: 44px !important;
    min-height: 0 !important;
}

.bill-paypal-field iframe {
    width: 100% !important;
    height: 44px !important;
    max-height: 44px !important;
}

.bill-paypal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.bill-paypal-row .bill-paypal-field {
    margin-bottom: 0;
}

.bill-paypal venmo-button,
#venmo-button {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
}

.bill-ach-form .bill-help {
    margin-bottom: 0.75rem;
}

.bill-ach-mandate {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 1rem 0 1.25rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius);
    background: #f8fafc;
    cursor: pointer;
}

.bill-ach-mandate input {
    margin-top: 0.2rem;
    min-width: 1.1rem;
    min-height: 1.1rem;
}

.bill-ledger-row--invoice {
    border-left: 4px solid var(--bill-ledger-invoice);
}

.bill-ledger-row--payment {
    border-left: 4px solid var(--bill-ledger-payment);
}

/* Desktop tables: tr border-left is unreliable — use inset bar + row wash. */
.bill-table--ledger .bill-ledger-row--invoice td {
    background: #eef4fa;
}

.bill-table--ledger .bill-ledger-row--payment td {
    background: #eef8f1;
}

.bill-table--ledger .bill-ledger-row--invoice td:first-child {
    box-shadow: inset 6px 0 0 var(--bill-ledger-invoice);
    padding-left: calc(0.65rem + 2px);
}

.bill-table--ledger .bill-ledger-row--payment td:first-child {
    box-shadow: inset 6px 0 0 var(--bill-ledger-payment);
    padding-left: calc(0.65rem + 2px);
}

.bill-table--ledger .bill-ledger-row--invoice td:nth-child(3) {
    color: var(--bill-ledger-invoice);
    font-weight: 700;
}

.bill-table--ledger .bill-ledger-row--payment td:nth-child(4) {
    color: var(--bill-ledger-payment);
    font-weight: 700;
}

.bill-table--ledger tbody tr + tr td {
    border-top: 3px solid #fff;
}

.bill-ledger-cards {
    display: none;
    gap: 0.75rem;
}

.bill-card {
    padding: 0.9rem 1rem;
    border: 1px solid var(--bill-border);
    border-radius: var(--bill-radius);
    background: #fff;
}

.bill-card--invoice {
    border-left: 4px solid var(--bill-ledger-invoice);
}

.bill-card--payment {
    border-left: 4px solid var(--bill-ledger-payment);
}

.bill-card__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.bill-card__meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 0.5rem 0 0;
}

.bill-card__meta dt {
    font-size: 12px;
    font-weight: 700;
}

.bill-card__meta dd {
    margin: 0;
}

.bill-help,
.bill-muted {
    color: #5c656d;
}

.bill-address {
    white-space: pre-line;
}

.bill-service-address {
    margin-top: 0.5rem;
    font-size: 0.95em;
}

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

@media (max-width: 719px) {
    .bill-table--selectable thead,
    .bill-table--ledger thead {
        display: none;
    }

    .bill-table--selectable tr,
    .bill-table--ledger tr {
        display: block;
        margin-bottom: 0.85rem;
        border: 1px solid var(--bill-border);
        border-radius: var(--bill-radius);
        background: #fff;
    }

    /*
     * Mobile card layout sets display:block on rows, which would otherwise
     * override the HTML hidden attribute on collapsed detail rows.
     */
    .bill-table--selectable tr[hidden],
    .bill-table--ledger tr[hidden],
    .bill-detail-row[hidden] {
        display: none !important;
    }

    .bill-detail-row {
        margin-top: -0.55rem;
        border-style: dashed;
    }

    .bill-detail-row td {
        display: block;
        padding: 0.75rem;
    }

    .bill-detail-row td::before {
        content: none;
    }

    .bill-table--selectable td,
    .bill-table--ledger td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        border-bottom: 0;
    }

    .bill-table--selectable td::before,
    .bill-table--ledger td::before {
        content: attr(data-label);
        font-weight: 700;
    }

    .bill-table-wrap--desktop {
        display: none;
    }

    .bill-ledger-cards {
        display: grid;
    }

    .bill-dl > div {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 720px) {
    .bill-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media print {
    .thwd-site-header,
    .bill-dev-banner,
    .bill-snackbar,
    .bill-back,
    .bill-actions,
    .no-print,
    .bill-footer {
        display: none !important;
    }

    body.bill-body {
        background: #fff;
    }

    .bill-main {
        width: 100%;
        margin: 0;
    }

    .bill-table-wrap--desktop {
        display: block !important;
    }

    .bill-ledger-cards {
        display: none !important;
    }

    .bill-expand-caret {
        display: none !important;
    }
}
