/* money.css */

.page-skeleton.skeleton-money .sk-money-stack {
    gap: 10px;
}

.page-skeleton.skeleton-money .sk-money-balance {
    min-height: 98px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.page-skeleton.skeleton-money .sk-money-balance .sk-title {
    height: 12px;
    width: 44%;
}

.page-skeleton.skeleton-money .sk-money-balance .sk-amount {
    height: 28px;
    width: 52%;
}

.page-skeleton.skeleton-money .sk-money-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.page-skeleton.skeleton-money .sk-money-actions .sk-pill {
    width: 100%;
    height: 42px;
    border-radius: 14px;
}

.page-skeleton.skeleton-money .sk-money-timeline {
    min-height: 360px;
    position: relative;
}

.page-skeleton.skeleton-money .sk-money-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(120, 120, 120, 0.35);
}

.page-skeleton.skeleton-money .sk-money-timeline::after {
    content: '';
    position: absolute;
    inset: 16px 12px;
    background:
        radial-gradient(circle, rgba(120, 120, 120, 0.35) 4px, transparent 5px) 0 0 / 50% 74px repeat-y,
        radial-gradient(circle, rgba(120, 120, 120, 0.35) 4px, transparent 5px) 100% 36px / 50% 74px repeat-y;
}

@media (min-width: 1024px) {
    .page-skeleton.skeleton-money .sk-money-stack {
        max-width: 1280px;
    }
}

/* Sticky Controls Section */
.sticky-controls {
    position: sticky;
    top: 60px;
    z-index: 40;
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 0;
}

body.dark-mode .sticky-controls {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .filtered-total-pill {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .filtered-total-pill.income {
    background: rgba(242, 138, 30, 0.16);
    border-color: rgba(242, 138, 30, 0.36);
}

body.dark-mode .filtered-total-pill.expense {
    background: rgba(255, 59, 48, 0.16);
    border-color: rgba(255, 59, 48, 0.36);
}

/* Control Buttons */
.money-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 16px 20px;
    max-width: 100%;
}

.filtered-totals-pills {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 20px 14px;
}

.filtered-totals-pills.show {
    display: grid;
}

.filtered-total-pill {
    min-height: 30px;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    border: 1px solid transparent;
    background: rgba(0, 0, 0, 0.08);
    color: var(--text);
}

.filtered-total-pill.income {
    color: var(--accent-orange);
    border-color: rgba(242, 138, 30, 0.32);
    background: rgba(242, 138, 30, 0.12);
}

.filtered-total-pill.expense {
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.32);
    background: rgba(255, 59, 48, 0.12);
}

/* Balance Stat Container */
.balance-stat-container {
    width: 100%;
}

/* Balance Stat (Top) */
.balance-stat {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    width: calc(100% - 32px);
    margin: 12px 16px 8px 16px;
    padding: 18px 20px;
    background-color: rgba(0, 0, 0, 0.12);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(10px);
    min-height: 100px;
    gap: 12px;
}

body.dark-mode .balance-stat {
    background-color: rgba(242, 138, 30, 0.12);
    border-color: rgba(242, 138, 30, 0.22);
}

.balance-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    gap: 12px;
}

.balance-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background-color: transparent;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.balance-dropdown-btn:hover {
    opacity: 0.7;
}

.balance-dropdown-btn.active {
    transform: rotate(180deg);
}

.balance-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.balance-value {
    font-size: 32px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    line-height: 1;
    color: var(--text);
}

.btn-add {
    background-color: var(--accent-orange);
    color: white;
    flex: 1;
    max-width: 150px;
}

.btn-add:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.btn-add:active {
    transform: scale(0.98);
}

.btn-minus {
    background-color: #FF3B30;
    color: white;
    flex: 1;
    max-width: 150px;
}

.btn-minus:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.btn-minus:active {
    transform: scale(0.98);
}

/* Summary */
.money-summary {
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 0 16px;
    max-width: 100%;
    background-color: transparent;
    border-top: none;
    justify-content: center;
    align-items: stretch;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.money-summary.show {
    max-height: 150px;
    opacity: 1;
    padding: 12px 16px;
}

body.dark-mode .money-summary {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.summary-stat {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1 1 auto;
    min-width: 120px;
    padding: 14px 18px;
    background-color: rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    gap: 8px;
}

body.dark-mode .summary-stat {
    background-color: rgba(217, 74, 56, 0.12);
    border-color: rgba(242, 138, 30, 0.2);
}

.summary-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    align-self: flex-start;
}

.summary-value {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
    text-align: center;
    line-height: 1.2;
}

.summary-value.income {
    color: var(--accent-orange);
}

.summary-value.expense {
    color: #FF3B30;
}

.summary-value.net {
    color: var(--text);
}

.summary-divider {
    display: none;
}

/* Filter Button */
.filter-button-container {
    display: flex;
    justify-content: flex-end;
    padding: 8px 16px;
    background-color: transparent;
}

/* Floating Filter Button */
.filter-button-container.floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 0;
    background-color: transparent;
    z-index: 100;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.btn-filter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

/* ensure link inherits same appearance */
a.btn-filter-icon {
    text-decoration: none;
}

/* specific style tweaks for calendar icon if needed */
.btn-filter-icon.calendar-icon {
    color: none;
}

body.dark-mode .btn-filter-icon {
    border-color: rgba(242, 138, 30, 0.25);
    background-color: rgba(242, 138, 30, 0.12);
}

.btn-filter-icon:hover {
    background-color: rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.18);
}

body.dark-mode .btn-filter-icon:hover {
    background-color: rgba(242, 138, 30, 0.2);
    border-color: rgba(242, 138, 30, 0.35);
}

.btn-filter-icon:active {
    transform: scale(0.95);
}

/* Filters Section */
.filters-section {
    display: none;
}

/* Scrollable Timeline Container */
.timeline-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Top Gradient Fade */
.timeline-container::before {
    content: '';
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 25px;
    background: linear-gradient(to bottom, var(--bg) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 20;
    margin: 0;
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px);
}

body.dark-mode .timeline-container::before {
    background: linear-gradient(to bottom, var(--dark-bg) 0%, rgba(0, 0, 0, 0) 100%);
}

/* Timeline */
.timeline {
    position: relative;
    padding: 10px 0 20px 0;
    flex: 1;
    width: 100%;
    min-height: 200px;
}

/* Center Vertical Line on timeline itself (disabled, container handles it) */
.timeline::before {
    content: none;
}

body.dark-mode .timeline::before {
    background-color: rgba(255, 255, 255, 0.08);
}

.timeline-container {
    position: relative;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    width: 2px;
    height: 100%;
    /* fade from opaque at top to transparent at bottom */
    background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 100%);
    z-index: 1;
    pointer-events: none;
}

.timeline-container.timeline-no-transactions::before {
    content: none;
}

body.dark-mode .timeline-container::before {
    /* dark mode fade from light at top to transparent */
    background: linear-gradient(to bottom, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
}

/* Timeline Entry */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Timeline Entry Base - 3 Column Grid */
.timeline-entry {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
    animation: none;
    gap: 0;
}

html.app-animations-ready .timeline-entry {
    animation: slideIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.timeline-entry {
    transition: opacity 260ms ease, filter 260ms ease, transform 260ms ease;
}

.timeline-entry.focus-dimmed {
    opacity: 0.16;
    filter: blur(1.6px) saturate(0.85);
}

.timeline-entry.focus-target {
    opacity: 1;
    filter: none;
    z-index: 4;
}

.timeline-entry.focus-target .timeline-content {
    opacity: 1;
}

.timeline-entry.focus-pulse .timeline-content {
    animation: timelineFocusPulse 760ms cubic-bezier(0.22, 1, 0.36, 1) 2;
}

@keyframes timelineFocusPulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(217, 74, 56, 0);
    }
    50% {
        transform: scale(1.03);
        text-shadow: 0 0 12px rgba(217, 74, 56, 0.45);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(217, 74, 56, 0);
    }
}

/* Income (Left Side) - Column 1 */
.timeline-income-left {
    grid-template-columns: 1fr auto 1fr;
}

.timeline-income-left .timeline-content {
    grid-column: 1;
    text-align: right;
    padding: 0 20px 0 0;
    max-width: 100%;
}

/* Expense (Right Side) - Column 3 */
.timeline-expense-right {
    grid-template-columns: 1fr auto 1fr;
}

.timeline-expense-right .timeline-content {
    grid-column: 3;
    text-align: left;
    padding: 0 0 0 16px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

/* Timeline Dot - Center Column (Column 2) */
.timeline-dot {
    grid-column: 2;
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    border-radius: 50%;
    background-color: var(--accent-orange);
    border: 3px solid var(--card);
    box-shadow: 0 0 0 2px var(--accent-orange);
    z-index: 3;
    position: relative;
    margin: 0 auto;
    justify-self: center;
}

.timeline-entry.expense .timeline-dot {
    background-color: #FF3B30;
    box-shadow: 0 0 0 2px #FF3B30;
}

.timeline-income-left .timeline-dot {
    background-color: var(--accent-orange);
    box-shadow: 0 0 0 2px var(--accent-orange);
}

.timeline-expense-right .timeline-dot {
    background-color: #FF3B30;
    box-shadow: 0 0 0 2px #FF3B30;
}

/* Timeline Content Card */
.timeline-content {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    position: relative;
    transition: opacity 0.2s ease;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.timeline-content:hover {
    box-shadow: none;
    transform: none;
    opacity: 0.85;
}

.timeline-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.timeline-amount {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-orange);
    margin-bottom: 2px;
    word-break: break-word;
}

.timeline-entry.expense .timeline-amount {
    color: #FF3B30;
}

.timeline-income-left .timeline-amount {
    color: var(--accent-orange);
}

.timeline-expense-right .timeline-amount {
    color: #FF3B30;
}

.timeline-date {
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 3px;
    word-break: break-word;
    line-height: 1.2;
}

.timeline-note {
    font-size: 10px;
    color: var(--muted);
    font-style: italic;
    margin-top: 3px;
    padding-top: 0;
    border-top: none;
    word-break: break-word;
    overflow-wrap: break-word;
}

body.dark-mode .timeline-note {
    border-top-color: rgba(255, 255, 255, 0.05);
}

/* Empty State */
.timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timeline-empty p {
    font-size: 16px;
    margin-bottom: 8px;
}

.timeline-empty .subtitle {
    font-size: 14px;
}

/* Form Groups in Modal */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-select,
.filter-input {
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg);
    transition: border-color 0.2s ease;
}

body.dark-mode .filter-select,
body.dark-mode .filter-input {
    border-color: rgba(242, 138, 30, 0.25);
    background-color: rgba(20, 17, 15, 0.92);
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(217, 74, 56, 0.12);
}

.filter-input::placeholder {
    color: var(--muted);
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 16px;
}

body.dark-mode .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.modal-footer .btn-filter-reset {
    flex: 1;
    padding: 10px 16px;
    background-color: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

body.dark-mode .modal-footer .btn-filter-reset {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.modal-footer .btn-filter-reset:hover {
    background-color: rgba(0, 0, 0, 0.12);
}

body.dark-mode .modal-footer .btn-filter-reset:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.modal-footer .btn-primary {
    flex: 1;
}

/* Form Groups in Modal */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.form-group textarea {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg);
    transition: border-color 0.2s ease;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    border-color: rgba(242, 138, 30, 0.25);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(217, 74, 56, 0.12);
}

.form-group textarea {
    resize: none;
    height: 108px;
    min-height: 108px;
    max-height: 108px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(217, 74, 56, 0.58) transparent;
}

.form-group textarea::-webkit-scrollbar {
    width: 8px;
}

.form-group textarea::-webkit-scrollbar-track {
    background: transparent;
}

.form-group textarea::-webkit-scrollbar-thumb {
    background: rgba(217, 74, 56, 0.58);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.form-group textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(217, 74, 56, 0.74);
    background-clip: padding-box;
}

body.dark-mode .form-group textarea {
    scrollbar-color: rgba(242, 138, 30, 0.62) transparent;
}

body.dark-mode .form-group textarea::-webkit-scrollbar-thumb {
    background: rgba(242, 138, 30, 0.62);
    background-clip: padding-box;
}

body.dark-mode .form-group textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(242, 138, 30, 0.78);
    background-clip: padding-box;
}

.money-type-trigger {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

body.dark-mode .money-type-trigger {
    border-color: rgba(242, 138, 30, 0.25);
    background-color: rgba(20, 17, 15, 0.92);
}

.money-type-trigger:focus-visible {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(217, 74, 56, 0.12);
}

.money-type-trigger[aria-expanded='true'] {
    border-color: rgba(217, 74, 56, 0.4);
}

.money-type-overlay {
    position: fixed;
    inset: 0;
    z-index: 2150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.money-type-overlay.show,
.money-type-overlay.closing {
    opacity: 1;
    pointer-events: auto;
}

.money-type-overlay-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: default;
}

.money-type-overlay-dropdown {
    position: fixed;
    display: grid;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: var(--card);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
    transform: translateY(-6px) scale(0.98);
    opacity: 0;
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
}

.money-type-overlay.show .money-type-overlay-dropdown {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.money-type-overlay.closing .money-type-overlay-dropdown {
    transform: translateY(-4px) scale(0.99);
    opacity: 0;
}

.money-type-option {
    min-height: 44px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    padding: 0 12px;
}

.money-type-option.active {
    border-color: rgba(217, 74, 56, 0.45);
    background: rgba(217, 74, 56, 0.12);
}

body.dark-mode .money-type-option {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .money-type-option.active {
    border-color: rgba(242, 138, 30, 0.45);
    background: rgba(242, 138, 30, 0.14);
}

body.dark-mode .money-type-overlay-dropdown {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.money-datetime-trigger {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    position: relative;
    z-index: 3;
    pointer-events: auto;
}

body.dark-mode .money-datetime-trigger {
    border-color: rgba(242, 138, 30, 0.25);
    background-color: rgba(20, 17, 15, 0.92);
}

.money-datetime-trigger:focus-visible {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(217, 74, 56, 0.12);
}

.money-datetime-trigger[disabled] {
    opacity: 0.8;
    cursor: default;
}

.timeline-content.is-clickable {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.timeline-content.is-clickable:active {
    transform: scale(0.985);
}

.transaction-detail-content .form-group input[readonly],
.transaction-detail-content .form-group textarea[readonly],
.transaction-detail-content .money-datetime-trigger:not(.is-editing),
.transaction-type-view {
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.09);
    color: var(--muted);
}

body.dark-mode .transaction-detail-content .form-group input[readonly],
body.dark-mode .transaction-detail-content .form-group textarea[readonly],
body.dark-mode .transaction-detail-content .money-datetime-trigger:not(.is-editing),
body.dark-mode .transaction-type-view {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.14);
    color: rgba(255, 245, 236, 0.84);
}

.transaction-type-view {
    min-height: 46px;
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.transaction-detail-footer .btn {
    flex: 1;
}

.transaction-detail-footer {
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

#entryModal .modal-content,
#transactionDetailModal .modal-content {
    position: relative;
    z-index: 3;
    pointer-events: auto;
}

#entryModal.show,
#transactionDetailModal.show {
    pointer-events: auto;
}

#entryModal,
#transactionDetailModal {
    z-index: 2000;
}

#transactionDetailModal,
#transactionDetailModal .modal-content,
#transactionDetailModal .modal-header,
#transactionDetailModal .modal-body,
#transactionDetailModal .modal-footer {
    pointer-events: auto;
}

#transactionDetailModal .modal-footer .btn {
    touch-action: manipulation;
}

#transactionDetailModal .transaction-detail-footer {
    position: sticky;
    bottom: 0;
    background: var(--card);
    z-index: 5;
}

#removeTransactionConfirmModal {
    z-index: 2050;
}

.transaction-detail-footer .btn {
    pointer-events: auto;
}

.save-entry-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(10, 119, 221, 0.28);
    background: rgba(10, 119, 221, 0.08);
    color: var(--text);
}

.save-entry-btn:hover {
    background: rgba(10, 119, 221, 0.16);
}

.save-entry-btn:active {
    transform: scale(0.96);
}

.transaction-cancel-btn {
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--text);
}

.transaction-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.12);
}

body.dark-mode .save-entry-btn {
    border-color: rgba(130, 186, 255, 0.35);
    background: rgba(130, 186, 255, 0.12);
    color: #9dc8ff;
}

body.dark-mode .transaction-cancel-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
}

.money-toast-container {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 2200;
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.money-toast {
    min-width: min(320px, calc(100vw - 40px));
    max-width: 420px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff7ef;
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.money-toast.show {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode .money-toast {
    background: rgba(255, 255, 255, 0.12);
    color: #fff7ef;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.transaction-detail-body {
    padding-top: 8px;
    padding-bottom: 12px;
    display: grid;
    gap: 10px;
}

.transaction-detail-body .form-group {
    margin-bottom: 0;
    gap: 6px;
}

.transaction-detail-body textarea {
    height: 84px;
    min-height: 84px;
    max-height: 84px;
}

.transaction-detail-content .modal-header {
    padding-bottom: 10px;
}

.transaction-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.transaction-remove-btn {
    background: rgba(255, 59, 48, 0.14);
    border: 1px solid rgba(255, 59, 48, 0.36);
    color: #ff3b30;
}

.transaction-remove-btn:hover {
    background: rgba(255, 59, 48, 0.2);
}

.remove-transaction-footer .btn {
    flex: 1;
}

.remove-transaction-no {
    background: linear-gradient(135deg, #d94a38 0%, #f28a1e 100%);
    border-color: transparent;
    color: #fff;
}

.remove-transaction-yes {
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--text);
}

body.dark-mode .remove-transaction-yes {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
}

.money-time-picker-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(4px);
    z-index: 2100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.money-time-picker-backdrop.show {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.money-time-picker-sheet {
    width: min(600px, 100%);
    max-height: 80vh;
    overflow: hidden;
    background: var(--card);
    border-radius: 22px 22px 0 0;
    border: none;
    padding: 14px 12px 14px;
    transform: translateY(18px);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.money-time-picker-backdrop.show .money-time-picker-sheet {
    transform: translateY(0);
}

body.dark-mode .money-time-picker-sheet {
    border: none;
}

.time-picker-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 4px 2px 10px;
    margin-bottom: 6px;
    background: var(--card);
}

.time-picker-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.time-picker-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.picker-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(217, 74, 56, 0.24);
    background: rgba(217, 74, 56, 0.08);
    color: var(--text);
}

.time-picker-now-btn {
    min-height: 34px;
    border: 1px solid rgba(10, 119, 221, 0.28);
    border-radius: 999px;
    background: rgba(10, 119, 221, 0.08);
    color: #0a77dd;
    font-size: 13px;
    font-weight: 700;
    padding: 0 12px;
}

.time-picker-preview-pill {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text);
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.time-picker-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.time-picker-done {
    min-height: 38px;
}

body.dark-mode .time-picker-header {
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .picker-icon-btn {
    border-color: rgba(242, 138, 30, 0.38);
    background: linear-gradient(135deg, rgba(217, 74, 56, 0.2) 0%, rgba(242, 138, 30, 0.2) 100%);
}

body.dark-mode .time-picker-now-btn {
    border-color: rgba(130, 186, 255, 0.35);
    background: rgba(130, 186, 255, 0.12);
    color: #9dc8ff;
}

body.dark-mode .time-picker-preview-pill {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.money-date-picker-inline-wrap {
    padding: 4px 2px 10px;
    display: grid;
    gap: 6px;
    position: relative;
    z-index: 2;
}

.money-date-picker-inline-input {
    min-height: 42px;
}

.money-picker-stack {
    position: relative;
    min-height: 228px;
    justify-self: center;
    width: min(520px, 100%);
}

.time-wheel-wrap {
    --time-wheel-row-height: 44px;
    --time-wheel-padding-y: 70px;
    --time-wheel-wrap-top-pad: 10px;
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 0.8fr;
    gap: 8px;
    padding-top: var(--time-wheel-wrap-top-pad);
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.money-time-picker-sheet.money-time-mode .time-wheel-wrap {
    opacity: 1;
    pointer-events: auto;
}

.money-time-picker-sheet.money-date-mode .time-wheel-wrap {
    opacity: 0;
    pointer-events: none;
}

.time-wheel-col {
    min-width: 0;
    perspective: 900px;
}

.time-wheel-scroller {
    height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    border-radius: 14px;
    border: none;
    background: var(--card);
    padding: var(--time-wheel-padding-y) 0;
    -webkit-overflow-scrolling: touch;
    transform-style: preserve-3d;
}

body.dark-mode .time-wheel-scroller {
    border: none;
}

.time-wheel-scroller::-webkit-scrollbar {
    display: none;
}

.time-wheel-option {
    width: 100%;
    min-height: var(--time-wheel-row-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    font-weight: 600;
    scroll-snap-align: center;
    transition: color 0.14s ease, opacity 0.14s ease, transform 0.14s ease;
    opacity: 0.35;
    transform: scale(0.94) rotateX(0deg);
    transform-origin: center center;
}

.time-wheel-option.selected {
    opacity: 1;
    color: var(--text);
    transform: scale(1) rotateX(0deg);
}

.time-wheel-option.near-1 {
    transform: scale(0.97);
}

.time-wheel-option.near-2 {
    transform: scale(0.95);
}

.time-wheel-option.far {
    transform: scale(0.9);
}

.time-wheel-option.before-center.near-1 {
    transform: scale(0.96) rotateX(22deg);
}

.time-wheel-option.after-center.near-1 {
    transform: scale(0.96) rotateX(-22deg);
}

.time-wheel-option.before-center.near-2 {
    transform: scale(0.94) rotateX(34deg);
}

.time-wheel-option.after-center.near-2 {
    transform: scale(0.94) rotateX(-34deg);
}

.time-wheel-option.before-center.far {
    transform: scale(0.9) rotateX(44deg);
}

.time-wheel-option.after-center.far {
    transform: scale(0.9) rotateX(-44deg);
}

.time-wheel-center-guide {
    position: absolute;
    left: 4px;
    right: 4px;
    top: calc(var(--time-wheel-wrap-top-pad) + var(--time-wheel-padding-y) + (var(--time-wheel-row-height) / 2));
    transform: translateY(-50%);
    height: var(--time-wheel-row-height);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 0 12px rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

body.dark-mode .time-wheel-center-guide {
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.money-date-toggle {
    width: 100%;
    min-height: 42px;
    border-radius: 999px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    padding: 0 14px;
    text-align: left;
    cursor: pointer;
    position: relative;
    z-index: 3;
    pointer-events: auto;
}

body.dark-mode .money-date-toggle {
    background: rgba(255, 255, 255, 0.08);
}

.money-date-wheel-wrap {
    --date-wheel-row-height: 44px;
    --date-wheel-padding-y: 62px;
    --date-wheel-title-height: 14px;
    --date-wheel-title-gap: 6px;
    --date-wheel-wrap-top-pad: 2px;
    display: grid;
    grid-template-columns: 1fr 0.8fr 1fr;
    gap: 8px;
    position: absolute;
    inset: 0;
    padding-top: var(--date-wheel-wrap-top-pad);
    padding-left: 50px;
    padding-right: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.money-time-picker-sheet.money-date-mode .money-date-wheel-wrap {
    opacity: 1;
    pointer-events: auto;
}

.date-wheel-col {
    min-width: 0;
    perspective: 900px;
}

.date-wheel-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: var(--date-wheel-title-gap);
    height: var(--date-wheel-title-height);
    line-height: var(--date-wheel-title-height);
}

.date-wheel-scroller {
    height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-padding-top: var(--date-wheel-padding-y);
    scroll-padding-bottom: var(--date-wheel-padding-y);
    border-radius: 14px;
    background: var(--card);
    padding: var(--date-wheel-padding-y) 0;
    transform-style: preserve-3d;
}

.date-wheel-scroller::-webkit-scrollbar {
    display: none;
}

.date-wheel-option {
    min-height: var(--date-wheel-row-height);
    height: var(--date-wheel-row-height);
    line-height: var(--date-wheel-row-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
    scroll-snap-align: center;
    transition: opacity 150ms ease, transform 150ms ease, color 150ms ease;
    opacity: 0.35;
    transform: scale(0.94) rotateX(0deg);
    transform-origin: center center;
}

.date-wheel-option.selected {
    opacity: 1;
    color: var(--text);
    transform: scale(1) rotateX(0deg);
}

.date-wheel-option.near-1 {
    transform: scale(0.96) rotateX(22deg);
}

.date-wheel-option.near-2 {
    transform: scale(0.94) rotateX(34deg);
}

.date-wheel-option.far {
    transform: scale(0.9) rotateX(44deg);
}

.date-wheel-option.after-center.near-1 {
    transform: scale(0.96) rotateX(-22deg);
}

.date-wheel-option.after-center.near-2 {
    transform: scale(0.94) rotateX(-34deg);
}

.date-wheel-option.after-center.far {
    transform: scale(0.9) rotateX(-44deg);
}

.date-wheel-center-guide {
    position: absolute;
    left: 4px;
    right: 4px;
    top: calc(var(--date-wheel-wrap-top-pad) + var(--date-wheel-title-height) + var(--date-wheel-title-gap) + var(--date-wheel-padding-y) + (var(--date-wheel-row-height) / 2) + 15px);
    transform: translateY(-50%);
    height: var(--date-wheel-row-height);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 0 12px rgba(255, 255, 255, 0.18);
    pointer-events: none;
}

body.dark-mode .date-wheel-center-guide {
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* Responsive Design */
@media (max-width: 600px) {
    .money-controls {
        gap: 10px;
        padding: 12px 16px;
    }

    .btn-add,
    .btn-minus {
        max-width: none;
        flex: 1;
    }

    .filtered-totals-pills {
        gap: 10px;
        padding: 0 16px 12px;
    }

    .filtered-total-pill {
        font-size: 10.5px;
        min-height: 28px;
        padding: 5px 8px;
    }

    .balance-stat {
        margin: 8px 12px 8px 12px;
        width: calc(100% - 24px);
        padding: 14px 16px;
        min-height: 85px;
        gap: 10px;
    }

    .balance-value {
        font-size: 30px;
    }

    .money-summary {
        padding: 0;
        gap: 10px;
        flex-direction: row;
        justify-content: center;
        max-height: 0;
        margin: 0 12px;
        width: calc(100% - 24px);
    }

    .money-summary.show {
        max-height: 120px;
        padding: 12px 0;
    }

    .summary-stat {
        width: auto;
        flex: 1 1 auto;
        min-width: 100px;
        min-height: 65px;
        padding: 12px 14px;
    }

    .summary-label {
        font-size: 9px;
        letter-spacing: 0.2px;
    }

    .summary-value {
        font-size: 15px;
        line-height: 1;
    }

    .filter-button-container {
        padding: 8px 12px;
    }

    .btn-filter-icon {
        width: 36px;
        height: 36px;
    }

    .timeline-container {
        padding: 0 16px 16px 16px;
    }

    /* Mobile: Maintain Bifurcated 3-Column Layout */

    .timeline-entry {
        grid-template-columns: 1fr auto 1fr;
        margin-bottom: 14px;
        gap: 0;
    }

    .timeline-entry.income,
    .timeline-entry.expense {
        grid-template-columns: 1fr auto 1fr;
    }

    .timeline-income-left .timeline-content {
        grid-column: 1;
        text-align: right;
        padding: 0 16px 0 0;
        max-width: 100%;
    }

    .timeline-expense-right .timeline-content {
        grid-column: 3;
        text-align: left;
        padding: 0 0 0 16px;
        max-width: 100%;
    }

    .timeline-income-left .timeline-dot,
    .timeline-expense-right .timeline-dot {
        grid-column: 2;
        position: relative;
        left: auto;
        top: auto;
    }

    /* Floating filter button on mobile */
    .filter-button-container.floating {
        bottom: 20px;
        right: 20px;
    }

    .transaction-detail-content .modal-body,
    .remove-transaction-modal-content .modal-body {
        padding-top: 12px;
    }

    .money-type-overlay-dropdown {
        border-radius: 10px;
    }

    .money-time-picker-sheet {
        border-radius: 20px 20px 0 0;
        padding: 12px 10px 14px;
    }

    .time-wheel-wrap {
        --time-wheel-padding-y: 81px;
        --time-wheel-wrap-top-pad: 10px;
        grid-template-columns: 1fr 1fr 0.9fr;
        gap: 6px;
    }

    .time-wheel-scroller {
        height: 206px;
    }

    .time-wheel-option {
        font-size: 15px;
    }
}

@media (max-width: 400px) {
    .money-controls {
        gap: 10px;
        padding: 10px 12px;
    }

    .btn-add,
    .btn-minus {
        width: 100%;
    }

    .filtered-totals-pills {
        gap: 8px;
        padding: 0 12px 10px;
    }

    .filtered-total-pill {
        font-size: 10px;
        min-height: 27px;
        padding: 5px 7px;
    }

    .money-summary {
        padding: 0;
        gap: 8px;
        flex-direction: row;
        justify-content: center;
        max-height: 0;
        margin: 0 10px;
        width: calc(100% - 20px);
    }

    .money-summary.show {
        max-height: 100px;
        padding: 10px 0;
    }

    .summary-stat {
        width: auto;
        flex: 1 1 auto;
        min-width: 85px;
        min-height: 60px;
        padding: 10px 10px;
        gap: 6px;
    }

    .summary-label {
        font-size: 8px;
    }

    .summary-value {
        font-size: 14px;
        line-height: 1;
    }

    .timeline-container {
        padding: 0 12px 12px 12px;
    }

    .timeline {
        padding: 12px 0;
    }

    .timeline-entry {
        margin-bottom: 14px;
        /* Grid layout inherited from 600px */
    }

}

@media (max-width: 360px) {
    .money-controls { padding: 8px 10px; gap: 8px; }
    .filtered-totals-pills { gap: 7px; padding: 0 10px 8px; }
    .filtered-total-pill { font-size: 9.5px; min-height: 26px; padding: 4px 6px; }
    .money-summary { margin: 0 8px; width: calc(100% - 16px); }
    .summary-stat { min-width: 75px; min-height: 52px; padding: 8px; gap: 4px; }
    .timeline-container { padding: 0 8px 8px 8px; }
    .timeline-entry { margin-bottom: 12px; }
    .summary-value { font-size: 13px; }
}

@media (max-width: 320px) {
    .balance-stat {
        margin: 6px 8px;
        width: calc(100% - 16px);
        padding: 10px 12px;
        min-height: 70px;
    }

    .balance-value {
        font-size: 18px;
    }

    .money-summary {
        padding: 0;
        gap: 8px;
        flex-direction: row;
        justify-content: center;
        max-height: 0;
        margin: 0 8px;
        width: calc(100% - 16px);
    }

    .money-summary.show {
        max-height: 90px;
        padding: 8px 0;
    }

    .summary-stat {
        width: auto;
        flex: 1 1 auto;
        min-width: 80px;
        min-height: 58px;
        padding: 8px 9px;
        gap: 4px;
    }

    .summary-label {
        font-size: 7px;
        letter-spacing: 0;
    }

    .summary-value {
        font-size: 13px;
    }

    /* Grid layout maintained consistently from 600px */
}

/* Reduce Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .timeline-entry {
        animation: none;
    }

    .timeline-content {
        transition: none;
    }

    .timeline-entry.focus-dimmed {
        opacity: 0.35;
        filter: none;
    }

    .timeline-entry.focus-pulse .timeline-content {
        animation: none;
    }
}

@media (min-width: 1024px) {
    .desktop-main .sticky-controls,
    .desktop-main .timeline-container {
        max-width: 1120px;
        margin-left: auto;
        margin-right: auto;
    }

    .desktop-main .sticky-controls {
        top: 70px;
        padding-top: 4px;
        backdrop-filter: blur(10px);
    }

    .desktop-main .balance-stat {
        min-height: 110px;
    }

    .desktop-main .money-controls {
        padding: 14px 24px;
    }

    .desktop-main .btn-add,
    .desktop-main .btn-minus {
        max-width: 220px;
    }

    .desktop-main .timeline-container {
        padding-left: 20px;
        padding-right: 20px;
    }

    .desktop-main .filter-button-container.floating {
        right: 24px;
        bottom: 24px;
    }
}

/* Restore gating: keep money timeline/static state stable during hydration. */
html.app-restoring-state .money-summary,
html.app-restoring-state .timeline-entry,
html.app-restoring-state .timeline-content,
html.app-restoring-state #entryModal .modal-content,
html.app-restoring-state #filterModal .modal-content,
html.app-restoring-state #transactionDetailModal .modal-content,
html.app-restoring-state #removeTransactionConfirmModal .modal-content,
html.app-restoring-state .money-time-picker-sheet {
    transition: none !important;
    animation: none !important;
}
