:root {
    --navy: #0b1530;
    --navy-2: #131f3f;
    --navy-line: rgba(255,255,255,.07);
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --page-bg: #f1f5f9;
    --card-radius: 14px;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Hind Siliguri', 'Segoe UI', sans-serif;
    background: var(--page-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ================= Auth (login / register) ================= */
.auth-split { display: grid; grid-template-columns: 42% 58%; min-height: 100vh; }

.auth-side {
    position: relative; overflow: hidden;
    background: linear-gradient(160deg, #2563eb 0%, #1d4ed8 45%, #172e7a 100%);
    color: #fff; display: flex; flex-direction: column; justify-content: center;
    padding: 56px 8%;
}
.auth-side::before, .auth-side::after {
    content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08);
}
.auth-side::before { width: 340px; height: 340px; top: -120px; right: -90px; }
.auth-side::after { width: 220px; height: 220px; bottom: -80px; left: -60px; }
.auth-side > * { position: relative; z-index: 1; }
.auth-side-logo { background: #fff; border-radius: 14px; padding: 12px 18px; display: inline-block; align-self: flex-start; margin-bottom: 34px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.auth-side-logo img { height: 46px; display: block; }
.auth-side h2 { font-size: 30px; font-weight: 700; line-height: 1.35; margin: 0 0 12px; }
.auth-side p { font-size: 16px; opacity: .88; max-width: 380px; margin-bottom: 28px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.auth-points i { font-size: 16px; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #eef2f7; }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-card {
    background: #fff; border-radius: 18px; padding: 36px 34px 30px;
    box-shadow: 0 14px 40px rgba(15,23,42,.08);
}
.auth-title { font-size: 24px; font-weight: 700; color: var(--text); text-align: center; margin-bottom: 4px; }
.auth-subtitle { color: var(--muted); font-size: 14px; text-align: center; margin-bottom: 24px; line-height: 1.5; }
.auth-card label.form-label { font-weight: 600; font-size: 13.5px; color: #1e293b; margin-bottom: 6px; }
.auth-card label.form-label .req { color: #dc2626; }

.input-icon-group { position: relative; }
.input-icon-group .lead-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; color: #64748b; pointer-events: none; }
.input-icon-group .form-control {
    padding: 11px 44px 11px 40px; border-radius: 10px; border: 1px solid #d5dde8; font-size: 15px; background: #fff;
}
.input-icon-group .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.toggle-pass { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 6px 8px; font-size: 18px; color: #475569; cursor: pointer; line-height: 1; }
.toggle-pass:hover { color: var(--primary); }

.btn-login {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border: none; color: #fff;
    padding: 12px; border-radius: 10px; font-weight: 700; font-size: 15.5px; width: 100%; margin-top: 6px;
    box-shadow: 0 6px 16px rgba(37,99,235,.28);
}
.btn-login:hover { color: #fff; filter: brightness(1.05); }
.btn-login:disabled { opacity: .7; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-foot { text-align: center; color: #94a3b8; font-size: 12.5px; margin-top: 18px; }

@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .auth-main { min-height: 100vh; }
    .auth-mobile-logo { display: block; }
}
.auth-mobile-logo { display: none; text-align: center; margin-bottom: 22px; }
.auth-mobile-logo img { height: 48px; }

.boot-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* ================= App shell ================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 262px; flex-shrink: 0; background: var(--navy); color: #cbd5e1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--navy-line); }
.brand-logo { height: 38px; width: auto; display: block; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 17px; color: #fff; }
.brand-sub { font-size: 11.5px; color: #8fa3c2; letter-spacing: .04em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-group-head {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    background: none; border: none; color: #7c8db0; font-size: 11.5px; font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase; padding: 14px 12px 6px; cursor: pointer;
}
.nav-group-head i { font-size: 11px; transition: transform .15s; }
.nav-group-head.closed i { transform: rotate(-90deg); }

.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px;
    color: #b9c6db; font-size: 14.5px; text-decoration: none; transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i { font-size: 16px; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--navy-2); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(37,99,235,.22); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.sidebar-nav .nav-link.disabled { opacity: .45; cursor: not-allowed; }
.sidebar-nav .nav-link.disabled:hover { background: none; color: #b9c6db; }
.sidebar-nav .nav-link em { margin-left: auto; font-size: 10.5px; font-style: normal; background: rgba(255,255,255,.1); padding: 2px 8px; border-radius: 20px; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--navy-line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user .u-name { color: #fff; font-size: 14px; font-weight: 600; line-height: 1.2; }
.sidebar-user .u-sub { color: #8fa3c2; font-size: 12px; }
.sidebar-logout { padding: 0 14px 16px; }
.btn-logout { width: 100%; background: none; border: none; color: #fca5a5; padding: 9px 10px; border-radius: 9px; display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.btn-logout:hover { background: rgba(239,68,68,.15); color: #fecaca; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: #fff; padding: 12px 28px; display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; min-height: 58px;
}
.topbar-date { flex: 1; text-align: center; font-size: 13.5px; color: #334155; font-weight: 500; }
.topbar-date .sep { color: #cbd5e1; margin: 0 10px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--text); }
.topbar-user .avatar { width: 32px; height: 32px; font-size: 14px; }
.sidebar-toggle { display: none; background: none; border: none; font-size: 24px; color: var(--text); padding: 0; }

.page-content { padding: 26px 30px 48px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 26px; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }

.view-toggle { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.view-toggle button { border: none; background: none; padding: 7px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; color: #475569; cursor: pointer; }
.view-toggle button.active { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(37,99,235,.3); }

/* ================= Stat cards ================= */
.stat-card { border-radius: var(--card-radius); padding: 20px 22px; height: 100%; border: 1px solid rgba(15,23,42,.04); position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.45); top: -45px; right: -35px; }
.stat-card > * { position: relative; z-index: 1; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; box-shadow: 0 2px 6px rgba(15,23,42,.08); }
.stat-label { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: #475569; text-transform: uppercase; }
.stat-value { font-size: 27px; font-weight: 700; line-height: 1.2; color: var(--text); }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat-rows { margin-top: 14px; font-size: 13px; }
.stat-rows div { display: flex; justify-content: space-between; padding: 2px 0; }
.stat-rows .due { color: #dc2626; font-weight: 600; }
.stat-rows .paid { color: #15803d; font-weight: 600; }
.stat-bar { height: 5px; background: rgba(15,23,42,.1); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.stat-bar span { display: block; height: 100%; border-radius: 4px; }
.stat-foot { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

.tone-green  { background: linear-gradient(135deg, #dcfce7, #e0f2fe); }  .tone-green .stat-icon  { color: #16a34a; } .tone-green .stat-bar span  { background: #16a34a; }
.tone-blue   { background: linear-gradient(135deg, #dbeafe, #e0e7ff); }  .tone-blue .stat-icon   { color: #2563eb; } .tone-blue .stat-bar span   { background: #2563eb; }
.tone-orange { background: linear-gradient(135deg, #ffedd5, #fef3c7); }  .tone-orange .stat-icon { color: #ea580c; } .tone-orange .stat-bar span { background: #ea580c; }
.tone-violet { background: linear-gradient(135deg, #ede9fe, #e0e7ff); }  .tone-violet .stat-icon { color: #7c3aed; }
.tone-red    { background: linear-gradient(135deg, #fee2e2, #fce7f3); }  .tone-red .stat-icon    { color: #dc2626; }
.tone-slate  { background: linear-gradient(135deg, #e2e8f0, #f1f5f9); }  .tone-slate .stat-icon  { color: #334155; }

/* ================= Cards / tables ================= */
.content-card { background: #fff; border-radius: var(--card-radius); padding: 22px; border: 1px solid var(--line); height: 100%; }
.content-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 14px; padding-left: 10px; border-left: 3px solid var(--primary); }
.table-modern { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-modern tbody td { padding: 11px 6px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern td.num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 38px; margin-bottom: 10px; display: block; }

.menu-backdrop { display: none; }

@media (max-width: 992px) {
    .sidebar { position: fixed; left: -280px; z-index: 20; transition: left .2s ease; }
    .sidebar-toggle { display: block; }
    .app-shell.menu-open .sidebar { left: 0; }
    .app-shell.menu-open .menu-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; }
    .page-content { padding: 18px 16px 40px; }
    .topbar { padding: 10px 16px; }
    .topbar-date { text-align: left; font-size: 12.5px; }
    .topbar-date .hijri { display: none; }
    .topbar-user span { display: none; }
}

/* ================= Language switch ================= */
.lang-switch { display: inline-flex; background: #eef2f7; border-radius: 9px; padding: 3px; gap: 2px; }
.lang-switch button { border: none; background: none; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; }
.lang-switch button.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(15,23,42,.12); }
.auth-main { position: relative; }
.auth-lang { position: absolute; top: 20px; right: 24px; }
