:root {
    --app-bg: #f3f6fb;
    --card-bg: #ffffff;
    --text-main: #07152b;
    --text-sub: #51627a;
    --border: #dbe4f0;
    --line: #e7edf5;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--app-bg);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
    font-size: 15px;
    font-weight: 600;
}

.app-tabbar {
    display: none;
}

main,
.container,
.container-fluid {
    max-width: 1480px;
    margin: 0 auto;
    padding: 28px 22px 60px;
}

/* top nav */
.navbar,
header.navbar {
    min-height: 52px;
    background: #fff !important;
    border-bottom: 1px solid var(--line);
    padding: 0 20px;
}

.navbar-brand {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-main) !important;
    margin-right: 26px;
}

.navbar-nav {
    gap: 2px;
}

.nav-link {
    color: #334155 !important;
    font-size: 15px;
    font-weight: 800;
    padding: 15px 9px !important;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary) !important;
}

/* page head */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-head h1,
.page-head h2 {
    margin: 0;
    font-size: 32px;
    font-weight: 950;
    letter-spacing: -0.05em;
}

/* card */
.card,
.finance-card,
.finance-summary-card {
    border: 0 !important;
    border-radius: 16px !important;
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

.card-body {
    padding: 24px !important;
}

.finance-summary-card .card-body {
    padding: 26px !important;
}

.finance-summary-income {
    background: linear-gradient(135deg, #dcfce7, #ffffff);
}

.finance-summary-expense {
    background: linear-gradient(135deg, #fee2e2, #ffffff);
}

.finance-summary-loan {
    background: linear-gradient(135deg, #fef3c7, #ffffff);
}

.finance-summary-net {
    background: linear-gradient(135deg, #dbeafe, #ffffff);
}

/* text */
.eyebrow {
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 8px;
}

.card-title-lg {
    font-size: 24px;
    font-weight: 950;
    letter-spacing: -0.05em;
    line-height: 1.25;
    word-break: keep-all;
}

.card-title-sm {
    font-size: 20px;
    font-weight: 950;
    letter-spacing: -0.04em;
    line-height: 1.25;
}

.stat-label {
    color: #334155;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 950;
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.hero-value {
    font-size: 34px;
    font-weight: 950;
    letter-spacing: -0.05em;
    line-height: 1.15;
}

.small,
.form-text,
.text-secondary {
    color: var(--text-sub) !important;
    font-weight: 650;
}

/* amount colors */
.text-primary,
.amount-income {
    color: #0b63ff !important;
}

.text-danger,
.amount-expense {
    color: #c90000 !important;
}

.amount-card {
    color: #7c3aed !important;
}

.amount-transfer {
    color: var(--text-main);
}

/* forms */
.form-label {
    color: #26364d;
    font-size: 14px;
    font-weight: 900;
    margin-bottom: 8px;
}

.form-control,
.form-select {
    min-height: 48px;
    border-radius: 12px !important;
    border: 1px solid #c9d5e6 !important;
    color: var(--text-main);
    font-weight: 700;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.12) !important;
}

/* buttons */
.btn {
    border-radius: 12px !important;
    font-weight: 900 !important;
    min-height: 42px;
    padding: 9px 16px;
}

.btn-sm {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 10px !important;
    font-size: 13px;
}

.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: #adc6ff !important;
}

.btn-outline-danger {
    color: var(--danger) !important;
    border-color: #f5b5b5 !important;
}

/* badges */
.badge {
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 900;
}

.text-bg-success {
    background: #dcfce7 !important;
    color: #047857 !important;
}

.text-bg-warning {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.text-bg-secondary {
    background: #e5e7eb !important;
    color: #374151 !important;
}

.text-bg-info {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
}

/* tables */
.table {
    margin-bottom: 0;
    color: var(--text-main);
}

.table th {
    color: #334155;
    font-size: 13px;
    font-weight: 950;
    white-space: nowrap;
    border-bottom: 1px solid var(--border) !important;
    padding: 14px 10px !important;
}

.table td {
    font-size: 15px;
    font-weight: 650;
    vertical-align: middle;
    padding: 14px 10px !important;
    border-bottom: 1px solid var(--line) !important;
}

.table-hover tbody tr:hover {
    background: #f8fbff;
}

.mobile-scroll {
    width: 100%;
    overflow-x: auto;
}

.mobile-scroll table {
    min-width: 900px;
}

/* progress */
.finance-progress,
.progress.finance-progress {
    width: 100%;
    height: 12px;
    background: #e5edf7;
    border-radius: 999px;
    overflow: hidden;
}

.finance-progress .progress-bar,
.progress.finance-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 999px;
}

/* highlight */
.loan-create-highlight {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 16px;
    padding: 18px;
}

.loan-create-highlight .title {
    color: #1d4ed8;
    font-size: 15px;
    font-weight: 950;
    margin-bottom: 6px;
}

.loan-create-highlight .desc {
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

/* alert */
.alert {
    border: 0;
    border-radius: 14px;
    font-weight: 800;
    box-shadow: var(--shadow);
}

/* empty */
.empty-state {
    text-align: center;
    color: var(--text-sub);
    font-weight: 800;
    padding: 42px 10px;
}

/* charts */
canvas {
    min-height: 280px;
}

/* card link */
a.text-decoration-none .finance-card,
a .finance-card {
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

a.text-decoration-none:hover .finance-card,
a:hover .finance-card {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
}

/* loan/installment cards */
.finance-card .row.g-3 {
    row-gap: 18px !important;
}

.finance-card .stat-value {
    word-break: keep-all;
}

/* long text */
.text-truncate-cell {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td {
    word-break: keep-all;
}

/* danger border */
.border-danger {
    border: 1px solid rgba(220, 38, 38, 0.75) !important;
}

/* responsive */
@media (max-width: 1200px) {
    .nav-link {
        font-size: 14px;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .hero-value {
        font-size: 30px;
    }

    .stat-value {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 76px;
    }

    main,
    .container,
    .container-fluid {
        padding: 20px 14px 44px;
    }

    .page-head {
        align-items: stretch;
    }

    .page-head h1,
    .page-head h2 {
        font-size: 28px;
    }

    .page-head > * {
        width: 100%;
    }

    .page-head .d-flex,
    .page-head form {
        width: 100%;
    }

    .page-head .btn {
        flex: 1;
    }

    .card-body {
        padding: 18px !important;
    }

    .hero-value {
        font-size: 28px;
    }

    .stat-value {
        font-size: 21px;
    }

    .card-title-lg {
        font-size: 21px;
    }

    .navbar {
        overflow-x: auto;
        white-space: nowrap;
    }

    .navbar-nav {
        flex-direction: row;
    }

    .app-tabbar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid var(--line);
        box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.08);
    }

    .app-tabbar-item {
        display: flex;
        min-height: 42px;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        color: #334155;
        font-size: 12px;
        font-weight: 900;
        text-decoration: none;
        white-space: nowrap;
    }

    .app-tabbar-primary {
        background: var(--primary);
        color: #fff;
    }

    .transaction-list-table {
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    .transaction-list-table thead {
        display: none;
    }

    .transaction-list-table,
    .transaction-list-table tbody,
    .transaction-list-table tr,
    .transaction-list-table td {
        display: block;
        width: 100%;
    }

    .transaction-list-table tr {
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
    }

    .transaction-list-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        border-bottom: 0 !important;
        padding: 6px 0 !important;
        text-align: right !important;
        word-break: break-word;
    }

    .transaction-list-table td::before {
        content: attr(data-label);
        flex: 0 0 78px;
        color: var(--text-sub);
        font-size: 12px;
        font-weight: 900;
        text-align: left;
    }

    .transaction-list-table td:last-child {
        justify-content: flex-end;
        padding-top: 12px !important;
    }

    .transaction-list-table td:last-child::before {
        display: none;
    }
}
