* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Padauk', 'Inter', -apple-system, sans-serif;
}

body {
    background-color: #f4f6f9;
    color: #1e293b;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

.text-danger {
    color: #ef4444;
}

.text-success {
    color: #22c55e;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #ffffff;
    border-bottom-color: #0ea5e9;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Login */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.login-card {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.login-card .input-group {
    margin-bottom: 1.25rem;
}

.login-card input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

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

.sidebar {
    width: 260px;
    background-color: #0f172a;
    color: #ffffff;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar .brand {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #334155;
}

.sidebar .brand h3 {
    color: #38bdf8;
}

.sidebar nav {
    margin-top: 1.5rem;
    flex-grow: 1;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li a {
    display: block;
    color: #94a3b8;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.sidebar ul li a.active,
.sidebar ul li a:hover {
    background-color: #0ea5e9;
    color: #ffffff;
}

.main-content {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.form-control-inline {
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-card {
    border-top: 4px solid #0ea5e9;
    text-align: center;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    text-align: left;
    min-width: 650px;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.data-table th {
    background-color: #f8fafc;
    color: #475569;
}

.action-buttons {
    display: flex;
    gap: 0.3rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.bg-info {
    background-color: #38bdf8;
    color: #ffffff;
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.paid {
    background-color: #dcfce7;
    color: #15803d;
}

.status.due {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: #0ea5e9;
    color: #ffffff;
}

.btn-success {
    background: #22c55e;
    color: #ffffff;
}

.btn-warning {
    background: #f59e0b;
    color: #ffffff;
}

.btn-danger {
    background: #ef4444;
    color: #ffffff;
}

.btn-secondary {
    background: #64748b;
    color: #ffffff;
}

.btn-logout {
    background: #334155;
    color: #f8fafc;
    width: 100%;
    justify-content: center;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 1rem;
}

.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 750px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Detail Modal Styles */
.detail-container .d-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
}

/* Receipt Styles */
.receipt-box {
    border: 2px dashed #334155;
    padding: 1.5rem;
    background: #fff;
    border-radius: 8px;
}

.receipt-header {
    text-align: center;
    margin-bottom: 1rem;
}

.receipt-header h2 {
    font-size: 1.2rem;
    color: #0f172a;
}

.receipt-header .subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
}

.r-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.receipt-table th,
.receipt-table td {
    border: 1px solid #cbd5e1;
    padding: 0.5rem;
    text-align: right;
}

.receipt-table th {
    text-align: left;
}

.receipt-table .highlight {
    background: #f1f5f9;
    font-weight: bold;
}

.receipt-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .main-content {
        padding: 1rem;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    #receiptPrintArea,
    #receiptPrintArea * {
        visibility: visible;
    }

    #receiptPrintArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none;
    }

    .no-print,
    .sidebar,
    .topbar {
        display: none !important;
    }
}