:root {
    --sidebar-width: 260px;
    --primary: #4e73df;
    --bg: #f0f2f8;
    --card-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: #2d3748;
}

/* Auth */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f8f9fc 50%, #e8f4f8 100%);
    padding: 1rem;
}

.auth-wrapper { width: 100%; max-width: 420px; }

.auth-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(78, 115, 223, 0.12);
    padding: 2rem;
}

.auth-logo { height: 72px; object-fit: contain; }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid #e8ecf4;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    padding: 1rem 0;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid #f0f2f8;
}

.sidebar-brand img { height: 40px; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 1rem;
    color: #5a6a85;
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: #eef2ff;
    color: var(--primary);
}

.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid #f0f2f8; }

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    padding-bottom: 72px;
}

.topbar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #e8ecf4;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; flex: 1; }

.share-price-badge {
    background: #eef2ff;
    color: var(--primary);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.app-content { padding: 1.25rem 1.5rem; }

/* Cards */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

.stat-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.25rem;
}

.stat-cards .stat-card .card-body {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f8;
    font-size: 1.25rem;
}

.stat-label { font-size: 0.8rem; color: #8898aa; margin: 0; }

.stat-value { font-size: 1.75rem; font-weight: 700; margin: 0.15rem 0; }

.stat-sub, .stat-trend { font-size: 0.75rem; }

.chart-card .card-header { background: transparent; border-bottom: 1px solid #f0f2f8; }

.chart-legend { font-size: 0.8rem; color: #8898aa; display: flex; gap: 1rem; }

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-dot.capital { background: #4e73df; }
.legend-dot.loans { background: #1cc88a; }

.audit-timeline .audit-item {
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 2px solid #e8ecf4;
    margin-left: 6px;
    position: relative;
}

.audit-timeline .audit-item::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    left: -5px;
    top: 12px;
}

.audit-time { font-size: 0.75rem; color: #8898aa; display: block; }
.audit-user { font-weight: 600; font-size: 0.85rem; margin-right: 6px; }
.audit-action { font-size: 0.85rem; text-decoration: none; }

.management-activity-card {
    border: 1px solid #e3e9f5;
    box-shadow: 0 2px 8px rgba(78, 115, 223, 0.06);
}

.management-activity-table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    background: #f8f9fc;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.management-activity-table tbody td {
    vertical-align: middle;
    font-size: 0.9rem;
}

.management-activity-table .day-badge {
    font-weight: 500;
    min-width: 5.5rem;
}

@media (max-width: 767.98px) {
    .management-activity-table thead th:nth-child(7),
    .management-activity-table tbody td:nth-child(7) {
        display: none;
    }
}

/* Mobile */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e8ecf4;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 1050;
}

.mobile-bottom-nav .nav-item {
    text-align: center;
    color: #8898aa;
    text-decoration: none;
    font-size: 0.65rem;
    flex: 1;
}

.mobile-bottom-nav .nav-item i { display: block; font-size: 1.25rem; }

.mobile-bottom-nav .fab-center {
    background: var(--primary);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-top: -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show, .offcanvas-lg.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .offcanvas-lg { width: var(--sidebar-width); }
}

@media (min-width: 992px) {
    .offcanvas-lg:not(.sidebar) {
        position: static !important;
        transform: none !important;
        visibility: visible !important;
        background: transparent;
        border: 0;
    }
    .sidebar.offcanvas-lg {
        position: fixed !important;
        background: #fff !important;
        border-right: 1px solid #e8ecf4 !important;
    }
}

.fab-actions {
    position: fixed;
    right: 20px;
    bottom: 90px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1030;
}

.fab-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e8ecf4;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a6a85;
    text-decoration: none;
}

.fab-btn.fab-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

@media print {
    .sidebar, .topbar, .mobile-bottom-nav, .fab-actions { display: none !important; }
    .app-main { margin: 0 !important; }
}
