:root {
    --primary: #4f22ff;
    --primary-dark: #27106d;
    --primary-soft: #efeaff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f7f7fb;
    --white: #ffffff;
    --green: #138a36;
    --red: #e63946;
    --orange: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-logo {
    max-width: 100%;
    height: auto;
    max-height: 60px;
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav a {
    display: block;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--bg);
    color: var(--primary);
    border-left-color: var(--primary);
}

.main-content {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 60px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.mobile-menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.content-wrapper {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary-dark);
}

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* Dashboard Stats */
.stat-card {
    text-align: center;
}
.stat-card h3 {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 10px;
}
.stat-card p {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 0.875rem; }

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    background: var(--bg);
}

.table tr:hover { background: var(--primary-soft); }

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-paid { background: #d1fae5; color: var(--green); }
.badge-partially { background: #fef3c7; color: var(--orange); }
.badge-unpaid, .badge-overdue { background: #fee2e2; color: var(--red); }

/* Alerts */
.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}
.alert-success { background: #d1fae5; color: var(--green); }
.alert-error { background: #fee2e2; color: var(--red); }

/* Mobile */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .close-sidebar { display: block; }
    .main-content { margin-left: 0; }
    .mobile-menu-toggle { display: block; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 5px; }
}
