:root {
    --bg-color: #f2f4f6;
    --card-bg: #ffffff;
    --primary-color: #007aff;
    --text-color: #1c1c1e;
    --secondary-text: #8e8e93;
    --gap: 16px;
    --radius: 20px;
    --income-color: #34c759;
    --expense-color: #ff3b30;
    --nav-height: 80px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-bottom: calc(var(--nav-height) + 20px);
}

.container {
    max-width: 480px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    grid-auto-rows: auto;
}

h1, h2, h3, h4, p {
    margin: 0;
}

.bento-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.box-full {
    grid-column: span 2;
}

/* Header / Balance Card */
.balance-card {
    background: linear-gradient(135deg, #007aff 0%, #00c6ff 100%);
    color: white;
    height: 160px;
    justify-content: center;
}

.balance-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
}

/* Stats / Quick Actions */
.stat-box {
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 120px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    margin-top: 8px;
}
.stat-value.income { color: var(--income-color); }
.stat-value.expense { color: var(--expense-color); }

/* Recent Transactions */
.transactions-box {
    min-height: 300px;
}

.box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.box-title {
    font-size: 18px;
    font-weight: 600;
}

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

.bill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.bill-item:last-child { border-bottom: none; }

.bill-info {
    display: flex;
    flex-direction: column;
}
.bill-cat { font-weight: 500; }
.bill-desc { font-size: 12px; color: var(--secondary-text); }
.bill-amount { font-weight: 600; }
.bill-amount.income { color: var(--income-color); }
.bill-amount.expense { color: var(--expense-color); }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 12px;
    flex: 1;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 4px;
}

/* Center Action Button (Mic) */
.nav-center {
    position: relative;
    top: -20px;
    width: 64px;
    height: 64px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.nav-center:active {
    transform: scale(0.95);
}

.nav-center.recording {
    background: var(--expense-color);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Auth Pages */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
}

.auth-form {
    width: 100%;
    max-width: 320px;
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    display: block;
    text-decoration: none;
}

.link-text {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
}
.link-text a { color: var(--primary-color); text-decoration: none; }

/* Settings List */
.settings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.settings-item:last-child { border-bottom: none; }
.settings-icon { margin-right: 10px; color: var(--primary-color); width: 24px; text-align: center; }

/* Modal Bottom Sheet */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-end; /* Align to bottom */
}

.modal-content-sheet {
    background: white;
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    padding-bottom: 40px; /* Safe area */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Radio Button Group */
.radio-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--secondary-text);
}
.radio-btn.active {
    background: white;
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 200px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(-20px);
    font-size: 14px;
    pointer-events: auto;
}

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

.toast.success { background: var(--income-color); color: white; }
.toast.error { background: var(--expense-color); color: white; }
