* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
}

.app {
    display: flex;
    min-height: 100vh;
}


/* SIDEBAR */

.sidebar {
    width: 240px;
    background: #111827;
    color: white;
    padding: 24px 14px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    padding: 0 14px 28px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 4px;
}

.menu-item:hover,
.menu-item.active {
    background: #1f2937;
    color: white;
}


/* MAIN */

.main {
    margin-left: 240px;
    width: calc(100% - 240px);
}

.topbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0 0 6px;
    font-size: 26px;
}

.topbar p {
    margin: 0;
    color: #6b7280;
}

.user-area {
    color: #4b5563;
}

.content {
    padding: 30px;
}


/* STATS */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.stat-title {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 25px;
    font-weight: 700;
}


/* TOOLBAR */

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.search-box {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    flex: 1;
}

.search-box input {
    border: 0;
    outline: none;
    width: 100%;
    padding: 12px;
    font-size: 14px;
}

.toolbar select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 12px;
    background: white;
}


/* BUTTONS */

button {
    cursor: pointer;
    font-family: inherit;
}

.primary-button {
    border: 0;
    border-radius: 8px;
    padding: 11px 18px;
    background: #2563eb;
    color: white;
    font-weight: 600;
}

.primary-button:hover {
    background: #1d4ed8;
}

.secondary-button {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 11px 18px;
    background: white;
}


/* TABLE */

.table-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

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

th,
td {
    text-align: left;
    padding: 15px 18px;
    border-bottom: 1px solid #eef0f3;
    font-size: 14px;
}

th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 600;
}

td {
    color: #374151;
}

.customer-name {
    font-weight: 600;
}

.type-badge,
.status-badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
}

.type-badge.customer {
    background: #eff6ff;
    color: #1d4ed8;
}

.type-badge.supplier {
    background: #fef3c7;
    color: #92400e;
}

.status-badge {
    background: #dcfce7;
    color: #166534;
}

.balance-positive {
    color: #dc2626;
    font-weight: 600;
}

.balance-negative {
    color: #16a34a;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 45px;
    color: #9ca3af;
}


/* MODAL */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    width: 760px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 14px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0 0 5px;
}

.modal-header p {
    margin: 0;
    color: #6b7280;
}

.close-button {
    border: 0;
    background: none;
    font-size: 30px;
    color: #6b7280;
}

#customerForm {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 11px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2563eb;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}


/* RESPONSIVE */

@media (max-width: 1000px) {

    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .sidebar {
        width: 200px;
    }

    .main {
        margin-left: 200px;
        width: calc(100% - 200px);
    }
}


@media (max-width: 700px) {

    .sidebar {
        display: none;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: auto;
    }
}