:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #0ea5e9;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --bg: #f1f5f9;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}
body.dark {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Segoe UI',sans-serif; background:var(--bg); color:var(--text); transition:.3s; }

/* LAYOUT */
.wrapper { display:flex; min-height:100vh; }
.sidebar { width:260px; background:var(--sidebar-bg); color:var(--sidebar-text); flex-shrink:0; display:flex; flex-direction:column; position:fixed; height:100vh; overflow-y:auto; z-index:100; transition:.3s; }
.main-content { margin-left:260px; flex:1; padding:24px; }

/* SIDEBAR */
.sidebar-brand { padding:24px 20px; border-bottom:1px solid #1e293b; }
.sidebar-brand .logo { display:flex; align-items:center; gap:12px; text-decoration:none; color:#fff; }
.sidebar-brand .logo img { width:40px; height:40px; border-radius:10px; object-fit:cover; }
.sidebar-brand .site-name { font-size:16px; font-weight:700; line-height:1.2; }
.sidebar-brand .site-sub { font-size:11px; color:#64748b; }
.sidebar-nav { padding:16px 12px; flex:1; }
.nav-section-title { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:1.5px; color:#475569; padding:8px 10px 4px; }
.sidebar-nav a { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:8px; text-decoration:none; color:var(--sidebar-text); font-size:14px; transition:.2s; margin-bottom:2px; }
.sidebar-nav a:hover, .sidebar-nav a.active { background:var(--primary); color:#fff; }
.sidebar-nav a .icon { width:18px; text-align:center; flex-shrink:0; }
.sidebar-footer { padding:16px; border-top:1px solid #1e293b; }
.sidebar-footer a { display:flex; align-items:center; gap:10px; color:#ef4444; text-decoration:none; font-size:13px; padding:8px 10px; border-radius:8px; }
.sidebar-footer a:hover { background:#450a0a; }

/* TOPBAR */
.topbar { display:flex; align-items:center; justify-content:space-between; background:var(--card-bg); padding:14px 24px; border-radius:var(--radius); margin-bottom:24px; box-shadow:var(--shadow); }
.topbar-left { display:flex; align-items:center; gap:12px; }
.hamburger { background:none; border:none; cursor:pointer; padding:6px; border-radius:8px; color:var(--text); }
.hamburger:hover { background:var(--bg); }
.page-title { font-size:18px; font-weight:700; }
.topbar-right { display:flex; align-items:center; gap:16px; }
.btn-icon { background:none; border:1px solid var(--border); width:38px; height:38px; border-radius:10px; cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--text-muted); }
.btn-icon:hover { background:var(--bg); }
.user-avatar { width:36px; height:36px; border-radius:50%; background:var(--primary); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; cursor:pointer; }

/* STATS CARDS */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px,1fr)); gap:20px; margin-bottom:24px; }
.stat-card { background:var(--card-bg); border-radius:var(--radius); padding:22px 20px; box-shadow:var(--shadow); display:flex; align-items:center; gap:16px; }
.stat-icon { width:52px; height:52px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-size:22px; flex-shrink:0; }
.stat-icon.blue { background:#dbeafe; color:var(--primary); }
.stat-icon.green { background:#dcfce7; color:var(--success); }
.stat-icon.red { background:#fee2e2; color:var(--danger); }
.stat-icon.orange { background:#ffedd5; color:var(--warning); }
.stat-label { font-size:12px; color:var(--text-muted); margin-bottom:4px; }
.stat-value { font-size:26px; font-weight:800; }

/* CARDS */
.card { background:var(--card-bg); border-radius:var(--radius); box-shadow:var(--shadow); margin-bottom:24px; }
.card-header { padding:18px 22px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.card-title { font-size:15px; font-weight:700; }
.card-body { padding:22px; }

/* TABLES */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:14px; }
thead th { background:var(--bg); padding:11px 14px; text-align:left; font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.5px; color:var(--text-muted); border-bottom:2px solid var(--border); }
tbody td { padding:12px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
tbody tr:hover { background:var(--bg); }
tbody tr:last-child td { border-bottom:none; }

/* BADGES */
.badge { display:inline-block; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; }
.badge-paid { background:#dcfce7; color:#166534; }
.badge-unpaid { background:#fee2e2; color:#991b1b; }
.badge-pending { background:#fef9c3; color:#92400e; }
.badge-active { background:#dbeafe; color:#1e40af; }
.badge-inactive { background:#f1f5f9; color:#64748b; }

/* BUTTONS */
.btn { display:inline-flex; align-items:center; gap:6px; padding:9px 18px; border-radius:8px; font-size:13px; font-weight:600; border:none; cursor:pointer; text-decoration:none; transition:.2s; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-success { background:var(--success); color:#fff; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-warning { background:var(--warning); color:#fff; }
.btn-outline { background:transparent; border:1.5px solid var(--border); color:var(--text); }
.btn-outline:hover { background:var(--bg); }
.btn-sm { padding:5px 12px; font-size:12px; }
.btn-xs { padding:3px 8px; font-size:11px; border-radius:6px; }

/* FORMS */
.form-group { margin-bottom:18px; }
.form-label { display:block; font-size:13px; font-weight:600; margin-bottom:6px; color:var(--text); }
.form-control { width:100%; padding:10px 14px; border:1.5px solid var(--border); border-radius:8px; font-size:14px; background:var(--card-bg); color:var(--text); transition:.2s; }
.form-control:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.form-select { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 14px center; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }

/* MODAL */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:1000; align-items:center; justify-content:center; }
.modal-overlay.active { display:flex; }
.modal { background:var(--card-bg); border-radius:var(--radius); width:90%; max-width:560px; max-height:90vh; overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.modal-header { padding:18px 22px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-title { font-size:16px; font-weight:700; }
.modal-close { background:none; border:none; cursor:pointer; font-size:20px; color:var(--text-muted); }
.modal-body { padding:22px; }
.modal-footer { padding:16px 22px; border-top:1px solid var(--border); display:flex; gap:10px; justify-content:flex-end; }

/* TOASTS */
#toast-container { position:fixed; top:20px; right:20px; z-index:9999; display:flex; flex-direction:column; gap:8px; }
.toast { display:flex; align-items:center; gap:12px; padding:14px 18px; border-radius:10px; background:var(--card-bg); box-shadow:0 8px 24px rgba(0,0,0,.15); font-size:14px; font-weight:500; min-width:280px; animation:slideIn .3s ease; border-left:4px solid; }
.toast.success { border-color:var(--success); }
.toast.error { border-color:var(--danger); }
.toast.info { border-color:var(--primary); }
@keyframes slideIn { from { transform:translateX(120%); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* AUTH */
.auth-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,var(--primary-dark) 0%,var(--primary) 50%,var(--secondary) 100%); padding:20px; }
.auth-card { background:#fff; border-radius:20px; padding:44px; width:100%; max-width:440px; box-shadow:0 30px 80px rgba(0,0,0,.2); }
.auth-logo { text-align:center; margin-bottom:28px; }
.auth-logo .icon { width:64px; height:64px; background:var(--primary); border-radius:16px; display:flex; align-items:center; justify-content:center; font-size:28px; color:#fff; margin:0 auto 12px; }
.auth-logo h2 { font-size:22px; font-weight:800; color:#1e293b; }
.auth-logo p { font-size:13px; color:#64748b; margin-top:4px; }
.auth-tabs { display:flex; background:#f1f5f9; border-radius:10px; padding:4px; margin-bottom:24px; }
.auth-tab { flex:1; padding:9px; border:none; background:none; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer; color:#64748b; transition:.2s; }
.auth-tab.active { background:#fff; color:var(--primary); box-shadow:0 2px 8px rgba(0,0,0,.1); }

/* RESPONSIVE */
@media(max-width:768px) {
    .sidebar { transform:translateX(-100%); }
    .sidebar.open { transform:translateX(0); }
    .main-content { margin-left:0; padding:16px; }
    .form-row { grid-template-columns:1fr; }
    .stats-grid { grid-template-columns:1fr 1fr; }
}

/* USER PANEL */
.billing-timeline { display:flex; flex-direction:column; gap:12px; }
.bill-item { background:var(--card-bg); border-radius:var(--radius); padding:16px 20px; border:1.5px solid var(--border); display:flex; align-items:center; justify-content:space-between; transition:.2s; }
.bill-item:hover { border-color:var(--primary); box-shadow:var(--shadow); }
.bill-period { font-size:13px; color:var(--text-muted); }
.bill-amount { font-size:18px; font-weight:800; color:var(--primary); }
.profile-card { background:linear-gradient(135deg,var(--primary) 0%,var(--secondary) 100%); border-radius:var(--radius); padding:28px; color:#fff; margin-bottom:24px; }
.profile-avatar { width:64px; height:64px; background:rgba(255,255,255,.2); border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:800; margin-bottom:12px; }
.time-filter { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px; }
.time-btn { padding:6px 16px; border-radius:20px; border:1.5px solid var(--border); background:var(--card-bg); color:var(--text-muted); font-size:12px; font-weight:600; cursor:pointer; transition:.2s; }
.time-btn.active { background:var(--primary); border-color:var(--primary); color:#fff; }
