:root {
    --sidebar-width: 240px;
    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
    --sidebar-active: #2563eb;
    --topbar-height: 60px;
    --content-bg: #f3f4f6;
    --card-radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--content-bg);
    color: #1f2937;
    font-size: 14px;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #e5e7eb;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid #1f2937;
}
.sidebar-brand i { color: #60a5fa; }

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #d1d5db;
    text-decoration: none;
    font-size: .92rem;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.sidebar-nav a i { width: 18px; text-align: center; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}
.sidebar-nav a.logout-link { color: #fca5a5; }
.sidebar-nav a.logout-link:hover { color: #fecaca; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1030;
}

/* ---------- Main ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    z-index: 1020;
}
.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.content-area {
    padding: 20px;
    flex: 1;
}

/* ---------- Cards ---------- */
.stat-card {
    border-radius: var(--card-radius);
    background: #fff;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    border: 1px solid #eef0f2;
    height: 100%;
}
.stat-card .stat-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    font-weight: 600;
}
.stat-card .stat-value {
    font-size: 1.45rem;
    font-weight: 700;
    margin-top: 6px;
    color: #111827;
}
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}

.panel {
    background: #fff;
    border-radius: var(--card-radius);
    border: 1px solid #eef0f2;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    font-weight: 600;
    white-space: nowrap;
}
.table td { vertical-align: middle; font-size: .9rem; }

.type-credit { color: #059669; font-weight: 600; }
.type-debit  { color: #dc2626; font-weight: 600; }
.type-opening { color: #6b7280; font-weight: 600; }

.amount-positive { color: #059669; font-weight: 600; }
.amount-negative { color: #dc2626; font-weight: 600; }
.amount-zero     { color: #6b7280; font-weight: 600; }

/* ---------- Login ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #111827 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,.2);
}
.login-card .brand {
    text-align: center;
    margin-bottom: 24px;
}
.login-card .brand i {
    font-size: 2.2rem;
    color: #2563eb;
}
.login-card .brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 10px 0 4px;
}
.login-card .brand p { color: #6b7280; font-size: .85rem; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
}

@media (max-width: 575.98px) {
    .content-area { padding: 14px; }
    .stat-card .stat-value { font-size: 1.2rem; }
}

/* Print */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    body { background: #fff; }
}