@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Montserrat:wght@600;700&display=swap');

:root {
    --bg-page: #F5F7F9;
    --surface: #FFFFFF;
    --navy: #062A4D;
    --action: #087CC1;
    --action-hover: #056AA7;
    --table-header: #EAF5FB;
    --text: #1E2933;
    --text-muted: #667580;
    --border: #DCE3E8;
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 76px;
    --header-height: 72px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-page);
    color: var(--text);
}

h1, h2, h3, h4, h5, h6, .page-title {
    font-family: 'Montserrat', sans-serif;
    color: var(--navy);
}

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    color: #fff;
    flex-shrink: 0;
    min-height: 100vh;
    padding: 1.5rem 0;
    flex-direction: column;
    transition: width .2s ease;
    overflow-x: hidden;
}

.sidebar-desktop {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.15);
    margin-bottom: 1rem;
}

.sidebar-brand small {
    display: block;
}

.sidebar-logo {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    transition: max-width .2s ease;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 240px;
    height: auto;
    margin: 0 auto;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,.85);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: 1rem .75rem 0;
    padding: .5rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.85);
    border-radius: .375rem;
    cursor: pointer;
    width: calc(100% - 1.5rem);
    white-space: nowrap;
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar.sidebar-collapsed,
html.sidebar-collapsed-init .sidebar-desktop {
    width: var(--sidebar-width-collapsed);
}

.sidebar.sidebar-collapsed .nav-label,
.sidebar.sidebar-collapsed .sidebar-section-title,
html.sidebar-collapsed-init .sidebar-desktop .nav-label,
html.sidebar-collapsed-init .sidebar-desktop .sidebar-section-title {
    display: none !important;
}

.sidebar.sidebar-collapsed .sidebar-brand,
html.sidebar-collapsed-init .sidebar-desktop .sidebar-brand {
    padding: 0 .5rem 1rem;
    display: flex;
    justify-content: center;
}

.sidebar.sidebar-collapsed .sidebar-logo,
html.sidebar-collapsed-init .sidebar-desktop .sidebar-logo {
    max-width: 44px;
}

.sidebar.sidebar-collapsed .sidebar-nav .nav-link,
html.sidebar-collapsed-init .sidebar-desktop .sidebar-nav .nav-link {
    justify-content: center;
    padding: .75rem .5rem;
    gap: 0;
}

.sidebar.sidebar-collapsed .sidebar-collapse-btn,
html.sidebar-collapsed-init .sidebar-desktop .sidebar-collapse-btn {
    width: calc(100% - 1rem);
    margin-left: .5rem;
    margin-right: .5rem;
    padding: .5rem 0;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,.08);
    color: #fff;
    border-left-color: var(--action);
}

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.top-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.content-area { padding: 1.5rem; flex: 1; min-width: 0; overflow-x: hidden; }

.card-solana {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .5rem;
    box-shadow: 0 1px 3px rgba(6,42,77,.06);
}

.btn-primary {
    background: var(--action);
    border-color: var(--action);
}

.btn-primary:hover {
    background: var(--action-hover);
    border-color: var(--action-hover);
}

.table thead {
    background: var(--table-header);
}

.table thead th {
    color: var(--navy);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.table td.text-end,
.table th.text-end {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    width: 1%;
}

.filter-panel { background: var(--table-header); }

.status-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    padding: .5rem .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .375rem;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(0, 39, 77, 0.72) 0%, rgba(10, 61, 110, 0.55) 100%),
        url('/images/banner.jpg') center / cover no-repeat fixed;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: .75rem;
    padding: 2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
}

.dashboard-card {
    transition: transform .15s, box-shadow .15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6,42,77,.12);
    color: inherit;
}

.kpi-card {
    padding: 1.15rem 1.25rem;
}

.kpi-card:has(> .card-body) {
    padding: 0;
}

.kpi-card > .card-body {
    padding: 1.15rem 1.25rem;
}

.kpi-label {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .35rem;
}

.kpi-value {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.05rem, 1.5vw, 1.4rem);
    font-weight: 700;
    color: var(--navy);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}

.kpi-meta {
    margin-top: .4rem;
    font-size: .8rem;
    color: var(--text-muted);
}

.kpi-card.kpi-danger .kpi-value { color: #b42318; }
.kpi-card.kpi-success .kpi-value { color: #067647; }

.dashboard-money {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 600;
}

.dashboard-table {
    width: 100%;
}

.dashboard-table th,
.dashboard-table td {
    vertical-align: middle;
}

.dashboard-table th:last-child,
.dashboard-table td:last-child {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dashboard-party {
    min-width: 0;
    max-width: 16rem;
}

.aging-row .dashboard-money {
    flex-shrink: 0;
    margin-left: .75rem;
}

.aging-track {
    height: 6px;
    background: var(--table-header);
    border-radius: 99px;
    overflow: hidden;
    margin-top: .25rem;
}

.aging-fill {
    height: 100%;
    background: var(--action);
    border-radius: 99px;
}

@media (max-width: 575.98px) {
    .kpi-value { white-space: normal; }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245,247,249,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: wait;
    pointer-events: all;
}

.text-muted-custom { color: var(--text-muted) !important; }

.breadcrumb { --bs-breadcrumb-divider: '›'; }

@media (max-width: 991.98px) {
    .sidebar-desktop { display: none !important; }
}

@media (min-width: 992px) {
    .sidebar-mobile-trigger { display: none !important; }
}

.offcanvas.sidebar-offcanvas {
    background: var(--navy);
    color: #fff;
    width: var(--sidebar-width);
}

.offcanvas.sidebar-offcanvas .nav-link {
    color: rgba(255,255,255,.85);
    padding: .75rem 1rem;
}

.sync-summary .badge { font-size: .85rem; }

.tab-actions .btn { min-width: 180px; }

.table-file-header {
    background: var(--table-header);
}

.table-file-header td {
    color: var(--navy);
    font-weight: 600;
    border-top: 2px solid var(--border);
}
