:root {
    --bg-color: #FDFBF7;
    --text-main: #2D3748;
    --text-muted: #4A5568;
    --primary: #2D3748;
    --primary-hover: #1A202C;
    --negative: #E53E3E;
    --positive: #38A169;
    --font-hand: 'Caveat', cursive;
}

body {
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(90deg, transparent 5%, rgba(229, 62, 62, 0.25) 5%, rgba(229, 62, 62, 0.25) 5.2%, transparent 5.2%),
        repeating-linear-gradient(transparent, transparent 31px, rgba(0, 0, 0, 0.06) 31px, rgba(0, 0, 0, 0.06) 32px);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-hand);
    font-size: 1.5rem;
    line-height: 2rem;
    margin: 0;
    padding: 2rem 2rem 2rem 6%; /* 6% aligns just right of the 5% margin */
    min-height: 100vh;
}

.app-container {
    max-width: 1200px; /* Center layout to balance empty space */
    margin: 0 auto;
    background: transparent;
}

/* Header */
.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(90deg, transparent 5%, rgba(229, 62, 62, 0.25) 5%, rgba(229, 62, 62, 0.25) 5.2%, transparent 5.2%),
        repeating-linear-gradient(transparent, transparent 31px, rgba(0, 0, 0, 0.06) 31px, rgba(0, 0, 0, 0.06) 32px);
    background-attachment: fixed;
    padding: 1rem 0;
    margin-top: -1rem;
    margin-bottom: 2rem;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
h1 {
    font-size: 2.2rem;
    margin: 0;
    font-weight: 700;
}
.all-time-total {
    font-size: 1.8rem;
    color: var(--text-muted);
}
#all-time-amount {
    font-size: 2.2rem;
    color: var(--text-main);
    font-weight: 700;
    margin-left: 0.5rem;
}

/* Month Nav */
.month-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.month-nav h2 {
    font-size: 2.8rem;
    margin: 0;
}
.btn-icon {
    background: transparent;
    border: 2px solid var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-main);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: var(--font-hand);
}
.btn-icon:hover {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
}

/* Layout */
.ledger-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: start;
}

.list-section, .small-add {
    background: transparent;
}

/* Add Section */
.small-add h3 {
    margin-top: 0;
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 1.5rem;
}
.input-group label {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
input, select {
    border: none;
    border-bottom: 2px solid rgba(0,0,0,0.2);
    background: transparent;
    padding: 0.5rem 0;
    font-family: var(--font-hand);
    font-size: 1.8rem;
    color: var(--text-main);
    transition: border-color 0.2s;
}
input:focus, select:focus {
    outline: none;
    border-bottom-color: var(--primary);
}
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-hand);
    margin-top: 0.5rem;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.full-width { width: 100%; }

/* Table Section */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.list-header h2 {
    margin: 0;
    font-size: 2.5rem;
}
.search-box {
    position: relative;
}
.search-box input {
    padding: 0.5rem 1rem 0.5rem 2.2rem;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.2);
    font-size: 1.4rem;
    background: rgba(255,255,255,0.5);
}
.search-box input:focus {
    background: white;
    border-color: var(--primary);
}
.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    font-size: 1.2rem;
}

.expense-table-container {
    overflow-x: auto;
}
.expense-table {
    width: 100%;
    border-collapse: collapse;
}
.expense-table th {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-family: 'Open Sans', sans-serif;
    text-transform: uppercase;
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    text-align: left;
}
.expense-table td {
    padding: 2rem 3rem 2rem 0; /* Bigger rows and lots of spacing between columns */
    vertical-align: middle;
    border-bottom: 1px dashed rgba(0,0,0,0.2);
    font-size: 1.8rem; /* Bigger font */
}
.expense-row {
    transition: background-color 0.2s;
}
.expense-row:hover {
    background-color: rgba(0,0,0,0.03);
}
.cat-badge {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.note-cell {
    color: var(--text-muted);
    font-size: 1.6rem;
}
.text-right {
    text-align: right;
}
.exp-amount {
    font-family: var(--font-hand);
    font-weight: bold;
    font-size: 1.8rem;
}
.btn-delete-row {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s, color 0.2s;
    font-size: 1.5rem;
    padding: 0;
}
.expense-row:hover .btn-delete-row {
    opacity: 1;
}
.btn-delete-row:hover {
    color: var(--negative);
}
.empty-list {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-muted);
    font-size: 1.8rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--text-main);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    font-size: 1.5rem;
    font-family: var(--font-hand);
}
.toast.hidden {
    transform: translateX(-50%) translateY(50px);
    opacity: 0;
}
.btn-undo {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 100px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    font-size: 1.2rem;
    font-family: var(--font-hand);
}
.btn-undo:hover {
    background: rgba(255,255,255,0.25);
}

/* Responsive */
@media (max-width: 1000px) {
    .ledger-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    body { padding-left: 8%; }
}

.hidden {
    display: none !important;
}
