/* =====================================================
   Transactions Page — mobile-first, premium UI
   ===================================================== */

/* ── Page layout ── */
.txn-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 5rem;
    /* space for FAB */
}

@media (min-width: 640px) {
    .txn-page {
        padding-bottom: 0;
    }
}

/* ── Header ── */
.txn-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.txn-header__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.txn-header__btn {
    white-space: nowrap;
}

/* ── Filters ── */
.txn-filters {
    padding: 1rem;
}

.txn-filters__bar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .txn-filters__bar {
        flex-direction: row;
        align-items: flex-end;
    }
}

.txn-filters__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out);
}

.txn-filters__toggle:active {
    background: #f3f4f6;
}

.txn-filters__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
}

.txn-filters__chevron {
    transition: transform var(--duration-base) var(--ease-out);
    margin-left: auto;
}

.txn-filters__chevron--open {
    transform: rotate(180deg);
}

/* Collapsible panel — hidden on mobile by default */
.txn-filters__panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--duration-smooth) var(--ease-out),
        opacity var(--duration-smooth) var(--ease-out);
    opacity: 0;
    overflow: hidden;
}

.txn-filters__panel>* {
    overflow: hidden;
}

.txn-filters__panel--open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-top: 0.75rem;
}

/* On sm+ always show the panel */
@media (min-width: 640px) {

    .txn-filters__panel,
    .sm\:txn-filters__panel--always {
        display: block !important;
        grid-template-rows: 1fr !important;
        opacity: 1 !important;
        margin-top: 0.75rem;
        overflow: visible;
    }
}

.txn-filters__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .txn-filters__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.txn-filters__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

/* ── Mini summary bar ── */
.txn-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    font-size: 0.8125rem;
    color: #6b7280;
}

.txn-summary__item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.txn-summary__count {
    font-weight: 600;
    color: #374151;
}

.txn-summary__dot {
    color: #d1d5db;
}

.txn-summary__item--income {
    color: var(--income);
    font-weight: 600;
}

.txn-summary__item--expense {
    color: var(--expense);
    font-weight: 600;
}

/* ── Transaction list ── */
.txn-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Date group ── */
.txn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.txn-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    margin: 0;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: capitalize;
}

.txn-group__date {
    letter-spacing: 0.01em;
}

.txn-group__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #9ca3af;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.txn-group__items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Transaction card ── */
.txn-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid #f3f4f6;
    border-left: 3.5px solid transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    text-align: left;
    cursor: pointer;
    transition: box-shadow var(--duration-smooth) var(--ease-out),
        border-color var(--duration-base) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
}

.txn-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
    border-color: #e5e7eb;
}

.txn-card:active {
    transform: scale(0.99);
}

/* Type-colored left border */
.txn-card--income {
    border-left-color: var(--income);
}

.txn-card--expense {
    border-left-color: var(--expense);
}

.txn-card--transfer {
    border-left-color: #3b82f6;
}

@media (min-width: 640px) {
    .txn-card {
        padding: 1rem 1.25rem;
        gap: 1rem;
    }
}

/* ── Category icon ── */
.txn-card__icon {
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.txn-card__icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ── Card body ── */
.txn-card__body {
    flex: 1;
    min-width: 0;
}

.txn-card__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .txn-card__title {
        font-size: 1rem;
    }
}

/* ── Two-line metadata ── */
.txn-card__meta {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: #9ca3af;
}

@media (min-width: 640px) {
    .txn-card__meta {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
}

.txn-card__category {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.txn-card__account {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #b0b5be;
}

@media (min-width: 640px) {
    .txn-card__account::before {
        content: '·';
        margin-right: 0.25rem;
        color: #d1d5db;
    }
}

/* ── Amount ── */
.txn-card__amount {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
}

@media (min-width: 640px) {
    .txn-card__amount {
        font-size: 1.0625rem;
    }
}

/* ── FAB ── */
.txn-fab {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 50;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(61, 203, 91, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring),
        box-shadow var(--duration-base) var(--ease-out);
}

.txn-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(61, 203, 91, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.12);
}

.txn-fab:active {
    transform: scale(0.95);
}