* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #16213e;
    --secondary: #0f3460;
    --accent: #e94560;
    --success: #00b894;
    --bg: #f8f9fa;
    --card: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --danger: #d63031;
    --warning: #fdcb6e;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 80px;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
    padding: 16px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

.header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 20px;
    border-radius: 0 0 20px 20px;
    margin: -16px -16px 20px -16px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header .subtitle {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 4px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #d63d56;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn-block {
    width: 100%;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 6px;
}

.input-group input,
.input-group select {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: var(--card);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 12px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    max-width: 480px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.7rem;
    padding: 4px 8px;
    transition: color 0.2s;
    background: none;
    border: none;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent);
}

.nav-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 11px;
    margin: 0;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s;
}

.list-item:hover {
    transform: translateX(4px);
}

.list-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    margin-right: 12px;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 600;
    font-size: 16px;
}

.list-item-subtitle {
    font-size: 14px;
    color: var(--text-light);
}

.list-item-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success, .badge-active, .badge-paid {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(253, 203, 110, 0.2);
    color: #e17055;
}

.badge-danger, .badge-overdue {
    background: rgba(214, 48, 49, 0.15);
    color: var(--danger);
}

.badge-attention {
    background: #fff3cd;
    color: #856404;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
}

.form-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
}

.form-page .header {
    margin-bottom: 24px;
}

.form-page form {
    flex: 1;
}

.form-footer {
    margin-top: 24px;
}

.form-footer p {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

.form-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.dashboard-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.dashboard-card-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.dashboard-card-label {
    font-size: 14px;
    color: var(--text-light);
}

.simulator-result {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-top: 20px;
}

.simulator-result .value {
    font-size: 36px;
    font-weight: 700;
    margin: 12px 0;
}

.simulator-result .label {
    font-size: 14px;
    opacity: 0.8;
}

.simulator-details {
    margin-top: 20px;
}

.simulator-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.simulator-row:last-child {
    border-bottom: none;
}

.simulator-row .label {
    color: var(--text-light);
}

.simulator-row .value {
    font-weight: 600;
}

@media (min-width: 480px) {
    body {
        background: var(--primary);
    }
    
    #app {
        background: var(--bg);
        min-height: 100vh;
        padding-bottom: 0;
    }
    
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 20px;
    text-align: center;
}

.login-logo-img {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 40px;
}

.login-container form {
    width: 100%;
    max-width: 320px;
}

.login-error {
    background: #ffebee;
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.login-spinner {
    margin-top: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bottom-nav.hidden {
    display: none;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #0f3460;
    --secondary: #16213e;
    --accent: #e94560;
    --success: #00b894;
    --bg: #1a1a2e;
    --card: #16213e;
    --text: #e0e0e0;
    --text-light: #a0a0a0;
}

[data-theme="dark"] .card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #1a1a2e;
    border-color: #333;
    color: #e0e0e0;
}

[data-theme="dark"] .bottom-nav {
    background: #16213e;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

[data-theme="dark"] .stat-card {
    background: #1a1a2e;
}
