/* Basic Setup maintained from V1, adding V2 specifics */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --primary-color: #2563eb;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --font-family: 'Inter', sans-serif;
    --nav-height: 70px;
}

[data-theme="dark"] {
    --bg-color: #111827;
    --text-color: #f9fafb;
    --card-bg: #1f2937;
    --border-color: #374151;
}

body {
    padding-bottom: var(--nav-height);
    /* Space for bottom nav */
}

/* ... (Keep previous basic utilities) ... */
/* Re-declaring essential utils for completeness */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding: 1rem;
}

.hidden {
    display: none !important;
}

button {
    border: none;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.top-bar h1 {
    font-size: 1.25rem;
}

.top-bar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-btn {
    background: none;
    padding: 8px;
    border-radius: 50%;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 90;
    max-width: 480px;
    margin: 0 auto;
    /* Center on desktop if constrained */
}

.nav-item {
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.7rem;
    color: #9ca3af;
    gap: 4px;
    flex: 1;
}

.nav-item.active {
    color: var(--primary-color);
}

.fab-container {
    position: fixed;
    bottom: 85px;
    /* Above the navbar */
    right: 20px;
    z-index: 100;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

/* KPI Cards */
.kpi-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.ready-to-assign {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.total-assets {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.kpi-card .amount {
    font-size: 2.25rem;
    font-weight: 800;
    margin-top: 0.5rem;
}

.kpi-card .label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Lists */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.btn-sm {
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    color: var(--text-color);
    font-size: 0.8rem;
}

/* Account Cards */
.accounts-grid {
    display: grid;
    gap: 1rem;
}

.account-card {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.acc-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 1rem;
}

.acc-details {
    flex: 1;
}

.acc-name {
    font-weight: 600;
}

.acc-type {
    font-size: 0.8rem;
    opacity: 0.7;
}

.acc-balance {
    font-weight: 700;
    font-size: 1.1rem;
}

.acc-balance.negative {
    color: #ef4444;
}

/* Category Items */
.category-item {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
}

.cat-progress {
    flex: 1;
    margin-left: 1rem;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.cat-bar {
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.cat-fill {
    height: 100%;
    border-radius: 3px;
}

/* Transaction List (Compact) */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.t-main {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.t-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.t-amount {
    font-weight: 700;
}

.t-amount.income {
    color: #10b981;
}

.t-amount.expense {
    color: var(--text-color);
}

.t-amount.transfer {
    color: var(--primary-color);
}

/* Modal & Form Improvements */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--card-bg);
    width: 100%;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 2rem;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.type-switcher {
    display: flex;
    background-color: var(--bg-color);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.type-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
    background: none;
}

.type-btn.active {
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.big-input input {
    font-size: 2.5rem;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 700;
    color: var(--text-color);
    width: 100%;
    margin-bottom: 1rem;
}

.big-input input:focus {
    outline: none;
}

.horizontal-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.account-option {
    min-width: 80px;
    text-align: center;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.2s;
}

.account-option.selected {
    opacity: 1;
    transform: scale(1.05);
}

.account-option .circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #eee;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
    color: #6b7280;
    font-size: 0.85rem;
}

.form-group input:not(.big-input input),
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.2s;
}

.form-group input[type="color"] {
    height: 45px;
    padding: 4px;
    cursor: pointer;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    width: 100%;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    border: none;
}

.close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Login */
.login-card {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.login-card input {
    margin: 1rem 0;
    padding: 1rem;
    text-align: center;
    font-size: 1.2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background-color: white;
    color: #444;
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    width: 100%;
    max-width: 300px;
    margin: 1rem 0;
    transition: background 0.2s;
}

.btn-google:hover {
    background-color: #f8f9fa;
}

.separator {
    width: 100%;
    max-width: 300px;
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Dashboard & Settings */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-grid .kpi-card {
    margin-bottom: 0;
    padding: 1.25rem;
}

.dashboard-grid .amount {
    font-size: 1.5rem;
}

.dashboard-acc-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-acc-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.dashboard-acc-item .name {
    flex: 1;
    font-size: 0.9rem;
}

.dashboard-acc-item .value {
    font-weight: 600;
}

/* Charts */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.chart-container h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

canvas {
    max-width: 100% !important;
}

.settings-grid {
    display: grid;
    gap: 1rem;
}

.settings-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
}

.settings-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.settings-card .icon-box {
    width: 44px;
    height: 44px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-card span {
    font-weight: 600;
    color: var(--text-color);
}

/* Hierarchy Styles */
.category-group {
    margin-bottom: 2rem;
}

.cat-group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.cat-group-title:hover {
    color: var(--primary-color);
}

.budget-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Help System Styles */
.help-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 2rem;
}

.help-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.help-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.help-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.8rem;
    color: #666;
}

[data-theme="dark"] .help-card p {
    color: #aaa;
}

.help-card ul {
    margin-left: 1.2rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #555;
}

[data-theme="dark"] .help-card ul {
    color: #eee;
}

.rule-item {
    margin-top: 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary-color);
}

.rule-item h4 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

/* Navbar adjustment for 6 items */
.bottom-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding: 0.5rem 0.2rem;
}

.nav-item i {
    width: 18px;
    height: 18px;
}

.nav-item span {
    font-size: 0.6rem;
}