/*
 | Wallet styles — Bootstrap CDN + this file
 */

:root {
    --wallet-teal: #33aa93;
    --wallet-teal-dark: #2c8a7a;
    --wallet-teal-focus: rgba(51, 170, 147, 0.25);
    --wallet-teal-hover-bg: rgba(51, 170, 147, 0.05);
    --wallet-muted-bg: #f8f9fa;
    --wallet-radius: 0.375rem;
    --wallet-ease: 0.2s ease-in-out;
    --touch: 44px;
    --touch-sm: 40px;
    --filter-h: 31px;
}

/* -------------------------------------------------------------------------
   Theme
   ------------------------------------------------------------------------- */

.wallet-heading,
.wallet-link,
.page-header-title,
.navbar-brand-wallet,
.btn-outline-success {
    color: var(--wallet-teal);
}

.wallet-link {
    text-decoration: underline;
}

.list-group-item {
    box-shadow: 0 0 0 0.1rem #33aa931a;
    border-radius: 0.5rem;
    border: none;
    margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--wallet-teal);
    box-shadow: 0 0 0 0.2rem var(--wallet-teal-focus);
}

.btn-success {
    background-color: var(--wallet-teal);
    border-color: var(--wallet-teal);
    color: #fff;
}

.btn-success:hover,
.btn-success:focus {
    background-color: var(--wallet-teal-dark);
    border-color: var(--wallet-teal-dark);
    color: #fff;
}

.btn-outline-success {
    border-color: var(--wallet-teal);
}

.btn-outline-success:hover {
    background-color: var(--wallet-teal);
    border-color: var(--wallet-teal);
    color: #fff;
}

.btn-outline-primary {
    border-color: var(--wallet-teal);
    color: var(--wallet-teal);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--wallet-teal);
    border-color: var(--wallet-teal);
    color: #fff;
}

.table-hover tbody tr:hover {
    background-color: var(--wallet-teal-hover-bg);
}

.wallet-card {
    transition: box-shadow var(--wallet-ease), transform var(--wallet-ease);
}

.wallet-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.wallet-table-container {
    min-height: 400px;
}

.auth-panel {
    max-width: 400px;
    margin-top: 2.5rem;
}

/* -------------------------------------------------------------------------
   Navigation
   ------------------------------------------------------------------------- */

.navbar-brand-wallet {
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
}

.navbar-brand-wallet:hover,
.navbar-brand-wallet:focus {
    color: var(--wallet-teal-dark);
}

.nav-link-plain {
    border: none;
    background: none;
}

.navbar-menu {
    display: none;
    width: 100%;
    flex-basis: 100%;
    order: 3;
    padding-top: 0.5rem;
}

.navbar-menu.is-open {
    display: block;
}

.navbar-brand {
    order: 1;
}

#navMenuToggle {
    order: 2;
}

.navbar-menu .navbar-nav {
    gap: 0.25rem;
}

.navbar-menu .nav-link,
.navbar-menu .btn.nav-link {
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
}

@media (min-width: 992px) {
    .navbar-menu {
        display: flex !important;
        width: auto;
        flex-basis: auto;
        order: 2;
        padding-top: 0;
        margin-left: auto;
    }

    .navbar-menu .navbar-nav {
        flex-direction: row;
        align-items: center;
    }
}

/* -------------------------------------------------------------------------
   Page headers
   ------------------------------------------------------------------------- */

.page-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem 0.5rem;
    margin-bottom: 0;
}

.page-header .btn {
    padding: 0.2rem 0.55rem;
    font-size: 0.8125rem;
    line-height: 1.25;
    min-height: 1.9rem;
    width: auto;
}

.page-header-back {
    justify-self: start;
    white-space: nowrap;
    padding: 0.15rem 0.35rem !important;
    font-size: 0.8125rem !important;
    font-weight: 500;
    color: #6c757d !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    text-decoration: none;
}

.page-header-back:hover,
.page-header-back:focus {
    color: var(--wallet-teal-dark) !important;
    background: transparent !important;
    text-decoration: underline;
}

.page-header-title {
    margin: 0;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.25;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-header-actions {
    justify-self: end;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
}

.page-header-actions > :is(.btn, .dropdown),
.page-header-actions > .dropdown > .btn,
.page-header-actions .dropdown-menu {
    width: auto;
}

.page-header-actions .dropdown-menu {
    min-width: 10rem;
}

/* Tighten Bootstrap spacing around page headers */
.row:has(.page-header),
.page-header.mb-4 {
    margin-bottom: 0.5rem !important;
}

main.py-4 {
    padding-top: 0.75rem !important;
    padding-bottom: 1rem !important;
}

.container.py-4,
.container-fluid.py-4 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.75rem !important;
}

.navbar.mb-4 {
    margin-bottom: 0.5rem !important;
}

@media (min-width: 768px) {
    .page-header {
        gap: 0.75rem;
    }

    .page-header .btn {
        padding: 0.3rem 0.7rem;
        font-size: 0.875rem;
        min-height: 2.1rem;
    }

    .page-header-title {
        font-size: 1.35rem;
    }

    .page-header--simple {
        grid-template-columns: 1fr auto 1fr;
    }

    .page-header--simple .page-header-back {
        justify-self: start;
    }

    .page-header--simple .page-header-title {
        grid-column: 2;
    }

    .page-header--simple .page-header-actions {
        grid-column: 3;
    }
}

/* -------------------------------------------------------------------------
   Pagination
   ------------------------------------------------------------------------- */

.pagination-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pagination-wrapper .pagination {
    margin-bottom: 0;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.pagination-wrapper .page-link {
    min-width: 40px;
    text-align: center;
    font-size: 0.875rem;
}

@media (max-width: 576px) {
    .pagination-wrapper .page-item:not(.active):not(:first-child):not(:last-child):not(.disabled),
    .pagination-wrapper .page-item.active ~ .page-item:nth-child(n + 3):not(:last-child) {
        display: none;
    }

    .pagination-wrapper .page-item:first-child ~ .page-item:nth-child(-n + 3):not(.active) {
        display: inline-block;
    }
}

/* -------------------------------------------------------------------------
   Filters & search
   ------------------------------------------------------------------------- */

.clickable-filter {
    cursor: pointer;
}

.clickable-filter:hover {
    filter: brightness(1.08);
}

.transaction-search {
    position: relative;
}

.transaction-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    font-size: 0.9rem;
    z-index: 2;
}

.transaction-search-input {
    padding-left: 2.25rem;
    border-radius: var(--wallet-radius);
}

.transaction-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    height: 0.9rem;
    width: 0.9rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236c757d'%3E%3Cpath d='M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854z'/%3E%3C/svg%3E") center / contain no-repeat;
    cursor: pointer;
}

@media (min-width: 768px) {
    .form-select-rounded,
    .filter-actions .btn-sm,
    .transaction-search-input.form-control-sm {
        height: var(--filter-h);
        padding-block: 0;
    }

    .form-select-rounded {
        border-radius: var(--wallet-radius) !important;
        display: flex !important;
        align-items: center !important;
        line-height: 1 !important;
    }
}

/* -------------------------------------------------------------------------
   Sticky summary table column
   ------------------------------------------------------------------------- */

.table-responsive:has(.table-sticky-first) {
    -webkit-overflow-scrolling: touch;
}

.table-sticky-first {
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.table-sticky-first > :not(caption) > * > * {
    border-width: 1px;
}

.table-sticky-first th:first-child,
.table-sticky-first td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: #fff;
    min-width: 4.5rem;
    box-shadow: 4px 0 6px -4px rgba(0, 0, 0, 0.12);
}

.table-sticky-first thead th:first-child,
.table-sticky-first tbody tr.bg-light td:first-child,
.table-sticky-first tbody tr:hover td:first-child {
    background-color: var(--wallet-muted-bg);
}

.table-sticky-first thead th:first-child {
    z-index: 3;
}

/* -------------------------------------------------------------------------
   Safe areas
   ------------------------------------------------------------------------- */

body {
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}

.navbar {
    padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}

footer,
.site-footer {
    position: relative;
    width: 100%;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* -------------------------------------------------------------------------
   Mobile — slim buttons & controls
   ------------------------------------------------------------------------- */

@media (max-width: 767.98px) {
    main.py-4 {
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom)) !important;
    }

    .navbar.mb-4 {
        padding-top: max(0.35rem, env(safe-area-inset-top));
    }

    .btn {
        min-height: 2rem;
        padding: 0.25rem 0.65rem;
        font-size: 0.8125rem;
        line-height: 1.25;
        border-radius: 0.375rem;
    }

    .btn-sm,
    .btn-group-sm > .btn,
    .page-header .btn {
        min-height: 1.75rem;
        height: auto !important;
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }

    .btn-lg {
        min-height: 2.25rem;
        padding: 0.35rem 0.85rem;
        font-size: 0.875rem;
    }

    .summary-actions .btn,
    .quick-submit,
    .txn-submit {
        min-height: 2.15rem;
        padding-block: 0.35rem;
        font-size: 0.875rem;
    }

    .navbar-toggler {
        min-height: 2rem;
        min-width: 2rem;
        padding: 0.35rem 0.45rem;
    }

    .navbar .nav-link,
    .navbar .btn.nav-link,
    .dropdown-item {
        min-height: 2.25rem;
        display: inline-flex;
        align-items: center;
        padding-block: 0.4rem;
        font-size: 0.875rem;
    }

    .pagination-wrapper .page-link {
        min-height: 1.85rem;
        min-width: 1.85rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.25rem 0.5rem;
        font-size: 0.8125rem;
    }

    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm {
        min-height: 2.15rem;
        font-size: 16px; /* avoid iOS zoom on focus */
        padding-block: 0.35rem;
    }

    .form-select-rounded {
        height: auto !important;
        line-height: 1.4 !important;
    }

    .transaction-search-input {
        padding-left: 2.35rem;
    }

    .transaction-search-icon {
        left: 0.75rem;
        font-size: 0.9rem;
    }

    .clickable-filter,
    a.badge {
        display: inline-flex;
        align-items: center;
        min-height: 1.4rem;
        padding: 0.15rem 0.45rem;
        font-size: 0.7rem;
    }

    .table a.text-decoration-underline {
        display: inline-block;
        padding: 0.2rem 0.25rem;
        min-height: auto;
        line-height: 1.3;
    }
}

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

.summary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    max-width: 40rem;
    margin-inline: auto;
}

.summary-actions .btn {
    min-height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 0.875rem;
    padding: 0.35rem 0.65rem;
}

.summary-card .card-body {
    padding: 0.75rem;
}

.summary-section + .summary-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.summary-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a9199;
}

.summary-table-wrap {
    margin-inline: 0;
    padding-bottom: 0;
}

.summary-table {
    --summary-border: rgba(0, 0, 0, 0.05);
    font-size: 0.8125rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    color: #5c636a;
    min-width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.summary-table > :not(caption) > * > * {
    border-width: 0;
}

.summary-table thead th {
    padding: 0.2rem 0.3rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #8a9199;
    background: transparent;
    border-bottom: 1px solid var(--summary-border);
    white-space: nowrap;
}

.summary-table tbody td {
    padding: 0.15rem 0.25rem;
    border-bottom: 1px solid var(--summary-border);
    white-space: nowrap;
    vertical-align: middle;
}

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

.summary-table th:not(:first-child),
.summary-table td:not(:first-child) {
    min-width: 2.85rem;
}

.summary-row-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: #8a9199;
    text-align: left !important;
    padding-left: 0.15rem !important;
}

.summary-empty {
    color: #d7dbe0;
    font-weight: 400;
}

.summary-total-row td {
    border-top: 1px solid rgba(0, 0, 0, 0.07) !important;
    background: rgba(51, 170, 147, 0.03);
}

.summary-total-row .summary-row-label {
    color: #7a858e;
}

.summary-cell-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.55rem;
    min-width: 2rem;
    padding: 0.1rem 0.15rem;
    text-decoration: none;
    color: #5c636a;
    font-weight: 400;
    border-radius: 0.25rem;
    cursor: pointer;
}

.summary-cell-link:hover,
.summary-cell-link:focus {
    color: var(--wallet-teal-dark);
    background: rgba(51, 170, 147, 0.08);
    text-decoration: none;
}

/* Sticky first column overrides for compact summary */
.summary-table.table-sticky-first th:first-child,
.summary-table.table-sticky-first td:first-child {
    min-width: 2.5rem;
    box-shadow: 3px 0 5px -4px rgba(0, 0, 0, 0.1);
}

.summary-table.table-sticky-first thead th:first-child,
.summary-table.table-sticky-first tbody tr.summary-total-row td:first-child,
.summary-table.table-sticky-first tbody tr:hover td:first-child {
    background-color: #fff;
}

.summary-table.table-sticky-first tbody tr.summary-total-row td:first-child {
    background-color: rgba(51, 170, 147, 0.04);
}

@media (min-width: 576px) {
    .summary-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        max-width: none;
    }

    .summary-actions .btn {
        width: auto;
    }
}

@media (min-width: 768px) {
    .summary-card .card-body {
        padding: 1rem 1.25rem;
    }

    .summary-section + .summary-section {
        margin-top: 1.5rem;
        padding-top: 1.15rem;
    }

    .summary-table {
        font-size: 0.875rem;
    }

    .summary-table thead th {
        padding: 0.25rem 0.4rem 0.4rem;
        font-size: 0.75rem;
    }

    .summary-table tbody td {
        padding: 0.2rem 0.35rem;
    }

    .summary-row-label {
        font-size: 0.8rem;
    }

    .summary-table th:not(:first-child),
    .summary-table td:not(:first-child) {
        min-width: 3.15rem;
    }

    .summary-cell-link {
        min-height: 1.7rem;
        min-width: 2.25rem;
    }
}

@media (max-width: 575.98px) {
    .summary-page.container-fluid {
        padding-inline: 0.75rem !important;
    }

    .summary-action-label {
        font-size: 0.9rem;
    }
}

/* -------------------------------------------------------------------------
   Quick Add
   ------------------------------------------------------------------------- */

.quick-page .card-body {
    padding: 0.9rem 1rem;
}

.quick-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.4rem;
}

.quick-pipe-btn {
    min-height: 1.9rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.quick-pipe-symbol {
    display: inline-block;
    margin-right: 0.35rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
}

.quick-lines-toolbar {
    margin-bottom: 0.65rem;
}

.quick-default {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-lines {
    font-size: 16px; /* avoid iOS zoom on focus */
    line-height: 1.45;
    min-height: calc(1.45em * 3 + 1.5rem);
    max-height: 70vh;
    overflow-y: auto;
    resize: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.quick-submit {
    min-height: 2.15rem;
}

.quick-type-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem 0.5rem;
}

.quick-type-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    min-height: 2rem;
    padding: 0.2rem 0.15rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #5c636a;
    cursor: pointer;
    user-select: none;
}

.quick-type-radio {
    width: 0.95rem;
    height: 0.95rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--wallet-teal);
    cursor: pointer;
}

.quick-type-radio-label {
    line-height: 1.2;
    white-space: nowrap;
}

.quick-type-option:has(.quick-type-radio:checked) {
    color: var(--wallet-teal-dark);
}

.quick-scan-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.quick-scan-pick,
.quick-scan-row .btn {
    min-height: 2rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quick-scan-pick {
    flex: 0 1 auto;
    max-width: 45%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-tips {
    border-radius: var(--wallet-radius);
    background: var(--wallet-muted-bg);
    padding: 0.65rem 0.9rem;
}

.quick-tips summary {
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6c757d;
    list-style: none;
    min-height: 1.85rem;
    display: flex;
    align-items: center;
}

.quick-tips summary::-webkit-details-marker {
    display: none;
}

.quick-tips summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.4rem;
    transition: transform 0.15s ease;
}

.quick-tips[open] summary::before {
    transform: rotate(90deg);
}

.quick-tips ul {
    padding-left: 1.1rem;
}

.quick-review-raw {
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-word;
}

.quick-review-card--ask {
    box-shadow: 0 0 0 0.12rem rgba(51, 170, 147, 0.35);
}

.quick-review-card--error {
    box-shadow: 0 0 0 0.12rem rgba(220, 53, 69, 0.25);
}

@media (max-width: 575.98px) {
    .quick-page.container {
        padding-inline: 1rem !important;
    }

    .quick-lines {
        min-height: calc(1.45em * 3 + 1.5rem);
        padding: 0.75rem;
    }

    .quick-type-option {
        font-size: 0.7rem;
        gap: 0.28rem;
        padding: 0.15rem 0;
    }

    .quick-type-radio {
        width: 0.9rem;
        height: 0.9rem;
    }

    .quick-entry-card {
        position: relative;
    }
}

@media (min-width: 768px) {
    .quick-page .card-body {
        padding: 1.15rem 1.25rem;
    }

    .quick-lines {
        min-height: calc(1.45em * 3 + 1.5rem);
        font-size: 0.95rem;
    }
}

/* -------------------------------------------------------------------------
   Transaction create / edit form
   ------------------------------------------------------------------------- */

.txn-form-page .txn-form-card .card-body {
    padding: 0.9rem 1rem;
}

.txn-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.3rem;
}

.txn-form-page .form-control,
.txn-form-page .form-select {
    font-size: 16px;
}

.txn-note {
    resize: vertical;
    min-height: 3.5rem;
}

.txn-submit {
    min-height: 2.15rem;
}

@media (max-width: 575.98px) {
    .txn-form-page.container {
        padding-inline: 1rem !important;
    }
}

@media (min-width: 768px) {
    .txn-form-page .txn-form-card .card-body {
        padding: 1.15rem 1.25rem;
    }

    .txn-form-page .form-control,
    .txn-form-page .form-select {
        font-size: 0.95rem;
    }
}

/* -------------------------------------------------------------------------
   Transactions list
   ------------------------------------------------------------------------- */

.txn-list-page {
    max-width: 40rem;
    margin-inline: auto;
}

.txn-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.txn-search-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.txn-search-row .transaction-search {
    flex: 1;
}

.txn-search-row .transaction-search-input {
    min-height: 2.25rem;
    font-size: 16px;
    border-radius: 0.5rem;
    border-color: rgba(0, 0, 0, 0.1);
    background: #fff;
}

.txn-search-go {
    min-height: 2.25rem;
    padding-inline: 0.75rem;
    border-radius: 0.5rem;
}

.txn-filter-panel {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    padding: 0;
    overflow: hidden;
}

.txn-filter-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.25rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6c757d;
    user-select: none;
}

.txn-filter-summary::-webkit-details-marker {
    display: none;
}

.txn-filter-summary::before {
    content: "▸";
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.txn-filter-panel[open] > .txn-filter-summary::before {
    transform: rotate(90deg);
}

.txn-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--wallet-teal);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
}

.txn-filter-body {
    padding: 0 0.75rem 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.txn-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding-top: 0.65rem;
}

.txn-filter-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: #8a9199;
    margin-bottom: 0.2rem;
}

.txn-filter-body .form-select {
    font-size: 16px;
    min-height: 2.15rem;
    border-radius: 0.4rem;
}

.txn-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.txn-list-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.65rem;
    overflow: hidden;
}

.txn-rows {
    display: flex;
    flex-direction: column;
}

.txn-row {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.txn-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.txn-row-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: #343a40;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.txn-amt {
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: #343a40;
    white-space: nowrap;
}

.txn-amt--out {
    color: #c45c5c;
}

.txn-amt--in {
    color: #2f9e78;
}

.txn-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.txn-row-meta {
    font-size: 0.72rem;
    color: #8a9199;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.txn-meta-sep {
    margin: 0 0.15rem;
    color: #c5cad0;
}

.txn-meta-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.txn-meta-link:hover,
.txn-meta-link:focus {
    color: var(--wallet-teal-dark);
    border-bottom-color: rgba(44, 138, 122, 0.45);
    outline: none;
}

.txn-row-actions {
    display: flex;
    gap: 0.55rem;
    flex-shrink: 0;
}

.txn-row-action {
    border: 0;
    background: none;
    padding: 0;
    font-size: 0.72rem;
    color: #6c757d;
    text-decoration: none;
    line-height: 1;
}

.txn-row-action:hover {
    color: var(--wallet-teal-dark);
}

.txn-row-action--danger:hover {
    color: #c45c5c;
}

.txn-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafbfc;
}

.txn-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #8a9199;
    font-size: 0.9rem;
}

@media (max-width: 575.98px) {
    .txn-list-page.container-fluid {
        padding-inline: 0.85rem !important;
    }
}

@media (min-width: 576px) {
    .txn-filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .txn-list-page {
        max-width: 48rem;
    }

    .txn-pagination {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .txn-row {
        padding: 0.8rem 1rem;
    }

    .txn-row-title,
    .txn-amt {
        font-size: 0.875rem;
    }
}

/* -------------------------------------------------------------------------
   Month / period detail
   ------------------------------------------------------------------------- */

.detail-page {
    max-width: 40rem;
    margin-inline: auto;
}

.detail-hero {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.65rem;
    padding: 0.65rem 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.detail-hero-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #8a9199;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-hero-value {
    font-size: 0.95rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #c45c5c;
}

.detail-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a9199;
}

.detail-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.65rem;
    overflow: hidden;
}

.detail-card--table {
    padding: 0.35rem 0.5rem 0.45rem;
}

.detail-account-table td,
.detail-account-table th {
    font-variant-numeric: tabular-nums;
}

.detail-account-table thead th:not(:first-child) {
    text-align: right;
    padding-right: 0.4rem;
}

.detail-account-table tbody td:not(.summary-row-label):not(.detail-total-amount) {
    font-size: 0.8125rem;
    font-weight: 400;
    color: #6c757d;
    text-align: right;
    padding-right: 0.4rem;
}

.detail-account-table tbody tr:hover td {
    background: rgba(0, 0, 0, 0.015);
}

.detail-account-table .summary-row-label {
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
}

.detail-account-table .summary-row-label .txn-meta-link {
    color: #343a40;
    font-weight: 500;
}

.detail-account-table .summary-row-label .txn-meta-link:hover {
    color: var(--wallet-teal-dark);
}

.detail-account-table .detail-val-in {
    color: #2a9d7a;
}

.detail-account-table .detail-val-out {
    color: #c45c5c;
}

.detail-account-table .detail-val-expense {
    font-size: 0.8125rem;
    font-weight: 400;
    color: #343a40;
}

.detail-account-table tbody td.detail-total-amount {
    font-size: 0.8125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #c0392b;
    text-align: right;
    padding-right: 0.4rem;
}

.detail-account-table .summary-total-row td {
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: #f8f9fa;
}

.detail-account-table .summary-total-row .summary-row-label {
    color: #5c636a;
    font-weight: 600;
}

.detail-account-table.table-sticky-first tbody tr.summary-total-row td:first-child,
.detail-account-table.table-sticky-first tbody tr:hover td:first-child {
    background-color: #f8f9fa;
}

.detail-account-table.table-sticky-first tbody tr:hover td:first-child {
    background-color: #fafbfc;
}

.detail-val-in {
    color: #2f9e78;
}

.detail-val-out,
.detail-val-expense {
    color: #c45c5c;
}

.detail-cat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.detail-cat-row:hover,
.detail-card .txn-row:hover {
    background: rgba(0, 0, 0, 0.015);
}

.detail-cat-row:last-child,
.detail-card .txn-row:last-child {
    border-bottom: 0;
}

.detail-cat-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #343a40;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-cat-amount {
    font-size: 0.8125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #c0392b;
    white-space: nowrap;
}

.detail-empty {
    padding: 1.25rem 0.85rem;
    text-align: center;
    font-size: 0.85rem;
    color: #8a9199;
}

.detail-card .txn-row {
    border-radius: 0;
    padding: 0.55rem 0.85rem;
}

.detail-page .txn-row-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #343a40;
}

.detail-page .txn-amt {
    font-size: 0.8125rem;
    font-weight: 500;
}

.detail-page .txn-amt--out {
    color: #c0392b;
}

.detail-page .txn-row-bottom {
    margin-top: 0.15rem;
}

.detail-page .txn-row-meta {
    font-size: 0.72rem;
    color: #8a9199;
}

.detail-page .txn-row-action {
    font-size: 0.72rem;
    color: #6c757d;
}

.detail-page .txn-row-action:hover {
    color: var(--wallet-teal-dark);
}

@media (max-width: 575.98px) {
    .detail-page.container-fluid {
        padding-inline: 0.85rem !important;
    }

    .detail-account-table .summary-row-label {
        max-width: 5.5rem;
    }
}

@media (min-width: 768px) {
    .detail-page {
        max-width: 48rem;
    }

    .detail-card--table {
        padding: 0.45rem 0.75rem 0.55rem;
    }

    .detail-cat-row,
    .detail-card .txn-row {
        padding: 0.6rem 1rem;
    }
}

/* -------------------------------------------------------------------------
   Accounts — drag reorder
   ------------------------------------------------------------------------- */

.account-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: #6c757d;
    cursor: grab;
    touch-action: none;
    user-select: none;
    border-radius: var(--wallet-radius);
}

.account-drag-handle:active {
    cursor: grabbing;
}

.account-drag-handle:hover,
.account-drag-handle:focus-visible {
    color: var(--wallet-teal);
    background: rgba(51, 170, 147, 0.08);
    outline: none;
}

#accounts-sortable tr.sortable-ghost {
    opacity: 0.45;
    background: var(--wallet-muted-bg);
}

#accounts-sortable tr.sortable-chosen {
    background: #fff;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}

/* -------------------------------------------------------------------------
   Accounts / categories index columns
   ------------------------------------------------------------------------- */

.col-display-order {
    width: 110px;
}

.col-default {
    width: 120px;
}

.col-actions {
    width: 140px;
}

/* -------------------------------------------------------------------------
   Quick entry
   ------------------------------------------------------------------------- */

.alert-pre-line {
    white-space: pre-line;
}

.scan-progress {
    height: 4px;
}

.scan-progress .progress-bar {
    width: 0%;
}

/* -------------------------------------------------------------------------
   Error pages
   ------------------------------------------------------------------------- */

.error-page-icon {
    font-size: 5rem;
}

.error-page-icon--teal {
    color: var(--wallet-teal);
}

.error-page-icon--danger {
    color: #dc3545;
}

.error-page-icon--warning {
    color: #ffc107;
}

.error-page-code--danger {
    color: #dc3545;
}

.error-page-code--warning {
    color: #ffc107;
}

.error-page-card--teal {
    background: linear-gradient(135deg, #f8fffe, #ffffff);
}

.error-page-card--warning {
    background: linear-gradient(135deg, #fff8e1, #ffffff);
}

.error-page-card-title--warning {
    color: #ffc107;
}

.error-page-check {
    color: #28a745;
}

.error-page-gear {
    color: #ffc107;
}

.btn-wallet-gradient {
    background: linear-gradient(135deg, var(--wallet-teal), var(--wallet-teal-dark));
    color: #fff;
    border: none;
    border-radius: 10px;
}

.btn-wallet-gradient:hover,
.btn-wallet-gradient:focus {
    background: linear-gradient(135deg, var(--wallet-teal-dark), var(--wallet-teal));
    color: #fff;
}

.btn-error-secondary {
    border-radius: 10px;
}

.error-page .btn:hover {
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

@keyframes error-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.error-page-icon--bounce {
    animation: error-bounce 2s infinite;
}

/* -------------------------------------------------------------------------
   Welcome (standalone landing — body.welcome-page)
   ------------------------------------------------------------------------- */

body.welcome-page {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fafafa;
    color: #333;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.welcome-page *,
body.welcome-page *::before,
body.welcome-page *::after {
    box-sizing: border-box;
}

.welcome-container {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.welcome-container h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--wallet-teal);
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.welcome-container p {
    color: #666;
    margin: 0 0 2rem;
    font-size: 1.1rem;
}

.welcome-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.welcome-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.welcome-btn-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.welcome-btn--primary {
    background: var(--wallet-teal);
    color: #fff;
}

.welcome-btn--primary:hover {
    background: var(--wallet-teal-dark);
    color: #fff;
}

.welcome-btn--secondary {
    background: #fff;
    color: var(--wallet-teal);
    border: 1px solid #e1e5e9;
}

.welcome-btn--secondary:hover {
    background: var(--wallet-muted-bg);
    color: var(--wallet-teal);
}
