:root { --bottom-nav-h: 64px; }

body {
    background: #f5f6fa;
    /* leave room for the fixed bottom nav + iOS safe area */
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

.amount-out { color: #dc3545; font-weight: 600; }
.amount-in { color: #198754; font-weight: 600; }

/* Top bar */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    padding: 0.75rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-topbar .navbar-brand {
    color: #fff !important;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-topbar .navbar-brand:hover {
    opacity: 0.9;
}

.app-topbar .btn-outline-light {
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
}

.app-topbar .btn-outline-light:hover,
.app-topbar .btn-outline-light:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: #fff;
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.2s ease, background-color 0.2s ease;
    position: relative;
}

.bottom-nav a:hover {
    color: #495057;
    background-color: rgba(0, 0, 0, 0.02);
}

.bottom-nav a i {
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.bottom-nav a:hover i {
    transform: scale(1.1);
}

.bottom-nav a.active {
    color: #0d6efd;
}

.bottom-nav a.active i {
    font-weight: 600;
}

/* Centered floating Add button */
.bottom-nav .nav-add {
    flex: 0 0 auto;
    position: relative;
    width: 76px;
}

.bottom-nav .nav-add .fab {
    position: absolute;
    top: -56px;
    left: 50%;
    transform: translateX(-50%);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.45);
    font-size: 1.6rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.bottom-nav .nav-add .fab:hover {
    transform: translateX(-50%) scale(1.05);
    background: #c82333;
}

.bottom-nav .nav-add.active .fab {
    background: #b02a37;
}

.bottom-nav .nav-add span:last-child {
    margin-top: 38px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    main.container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .app-topbar .navbar-brand {
        font-size: 1.15rem;
    }

    .bottom-nav a {
        font-size: 0.65rem;
        gap: 2px;
    }

    .bottom-nav a i {
        font-size: 1.25rem;
    }

    .bottom-nav .nav-add .fab {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
        top: -18px;
    }

    .bottom-nav .nav-add span:last-child {
        margin-top: 32px;
    }
}

/* Toast container */
.toast-container { z-index: 1090; }
