:root {
    --primary: #4A90E2;
    --primary-dark: #357ABD;
    --bg: #F4F7F6;
    --card-bg: #FFFFFF;
    --text-main: #333333;
    --text-muted: #777777;
    --success: #2ECC71;
    --danger: #E74C3C;
    --warning: #F1C40F;
    --border: #E0E0E0;
    --nav-bg: #FFFFFF;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    padding-bottom: 70px; /* space for bottom nav */
}

/* Utilities */
.hidden {
    display: none !important;
}

.error-msg {
    color: var(--danger);
    font-size: 0.9em;
    margin-top: 10px;
}

/* Auth View */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
}

.auth-container h1 {
    color: var(--primary);
    margin-bottom: 5px;
}

.auth-container p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input, select {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
}

button {
    padding: 12px;
    border: none;
    border-radius: 5px;
    background-color: var(--primary);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background-color: var(--primary-dark);
}

/* App Header */
header {
    background-color: var(--primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
}

#logout-btn {
    background: transparent;
    border: 1px solid white;
    padding: 5px 10px;
    font-size: 0.9em;
}

#logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Main Content */
#main-content {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.app-section {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dashboard Cards */
.overview-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.card-row {
    display: flex;
    gap: 15px;
}

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex: 1;
    text-align: center;
}

.card h3 {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.card p {
    font-size: 1.5em;
    font-weight: bold;
}

.balance p { color: var(--primary); }
.income p { color: var(--success); }
.expense p { color: var(--danger); }
.profit p { color: var(--text-main); }

/* Alerts */
.alerts-container {
    margin-bottom: 20px;
}

.alert-item {
    background-color: #FDEDEC;
    color: var(--danger);
    padding: 10px 15px;
    border-left: 4px solid var(--danger);
    margin-bottom: 10px;
    border-radius: 4px;
    font-weight: bold;
}

/* Section Blocks */
.section-block {
    margin-bottom: 25px;
}

.section-block h3 {
    margin-bottom: 10px;
    font-size: 1.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.list-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.list-item .name {
    font-size: 0.85em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
}

.list-item .val {
    font-weight: bold;
    color: var(--text-main);
}

/* Transactions */
.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.tx-card {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tx-info {
    display: flex;
    flex-direction: column;
}

.tx-title {
    font-weight: bold;
    font-size: 1.1em;
}

.tx-meta {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 5px;
}

.tx-val {
    font-weight: bold;
    font-size: 1.1em;
}

.tx-val.income { color: var(--success); }
.tx-val.expense { color: var(--danger); }
.tx-val.transfer { color: var(--warning); }

/* OS Section */
.os-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.os-summary {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.os-summary .stat {
    background: var(--card-bg);
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: bold;
}

.os-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.os-card {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.os-card.closed {
    border-left-color: var(--success);
}

.os-card-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 10px;
}

.os-card-body {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.os-card-actions {
    text-align: right;
}

.btn-close-os {
    background: var(--danger);
    padding: 5px 10px;
    font-size: 0.85em;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.nav-btn {
    background: none;
    color: var(--text-muted);
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8em;
    gap: 5px;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn i {
    font-size: 1.5em;
}

/* FAB */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 101;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-size: 1.5em;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.95);
}

.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    align-items: flex-end;
}

.fab-action {
    background-color: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: bold;
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
}
