* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Tahoma, sans-serif;
    background: #f5f6fa;
    color: #222;
    min-height: 100vh;
}


/* =========================
   Sidebar
========================= */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;

    width: 250px;
    height: 100vh;

    background: #ffffff;
    border-left: 1px solid #e5e5e5;

    padding: 25px 15px;

    display: flex;
    flex-direction: column;

    z-index: 100;
}


/* Logo */

.logo {
    text-align: center;
    margin-bottom: 35px;
}

.logo h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.logo span {
    font-size: 13px;
    color: #777;
}


/* Navigation */

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.sidebar a {
    text-decoration: none;
    color: #555;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 13px 15px;

    border-radius: 10px;

    font-size: 15px;

    transition: 0.2s;
}

.sidebar a:hover {
    background: #f1f2f6;
    color: #333;
}

.sidebar a.active {
    background: #4b3f72;
    color: white;
}


/* Bottom */

.sidebar-bottom {
    margin-top: auto;
}


/* =========================
   Main
========================= */

.main {
    margin-right: 250px;
    padding: 30px;
}


/* =========================
   Header
========================= */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 30px;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 7px;
}

.header p {
    color: #888;
    font-size: 14px;
}


/* User */

.user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification {
    border: none;
    background: white;

    width: 42px;
    height: 42px;

    border-radius: 10px;

    cursor: pointer;

    font-size: 18px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.user-info {
    display: flex;
    flex-direction: column;

    text-align: right;

    gap: 3px;
}

.user-info strong {
    font-size: 14px;
}

.user-info span {
    font-size: 12px;
    color: #888;
}

.avatar {
    width: 42px;
    height: 42px;

    background: #4b3f72;
    color: white;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: bold;
}


/* =========================
   Statistics Cards
========================= */

.stats {
    display: grid;

    grid-template-columns: repeat(4, 1fr);

    gap: 20px;

    margin-bottom: 25px;
}

.card {
    background: white;

    padding: 22px;

    border-radius: 15px;

    display: flex;
    align-items: center;

    gap: 17px;

    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.04);
}

.card-icon {
    width: 52px;
    height: 52px;

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 23px;
}

.card-icon.sales {
    background: #eeeafd;
}

.card-icon.stock {
    background: #e8f5e9;
}

.card-icon.profit {
    background: #fff4df;
}

.card-icon.customers {
    background: #e5f3ff;
}

.card span {
    color: #888;
    font-size: 13px;
}

.card h2 {
    margin-top: 7px;

    font-size: 21px;
}


/* =========================
   Content
========================= */

.content-grid {
    display: grid;

    grid-template-columns: 2fr 1fr;

    gap: 20px;
}


/* Panels */

.panel {
    background: white;

    border-radius: 15px;

    padding: 22px;

    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.04);
}

.panel-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 18px;
}

.view-all {
    border: none;

    background: transparent;

    color: #4b3f72;

    cursor: pointer;

    font-size: 13px;
}


/* =========================
   Table
========================= */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;
}

thead {
    background: #f8f8fb;
}

th {
    padding: 13px;

    text-align: right;

    font-size: 13px;

    color: #777;

    font-weight: normal;
}

td {
    padding: 15px 13px;

    border-bottom: 1px solid #eee;

    font-size: 13px;
}

tbody tr:last-child td {
    border-bottom: none;
}


/* Status */

.status {
    padding: 5px 10px;

    border-radius: 20px;

    font-size: 11px;
}

.status.success {
    background: #e8f7ed;

    color: #2d8a4b;
}

.status.pending {
    background: #fff3dc;

    color: #b77900;
}


/* =========================
   Low Stock
========================= */

.low-stock {
    display: flex;

    flex-direction: column;

    gap: 10px;
}

.product-warning {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 13px;

    border-radius: 10px;

    background: #fafafa;
}

.product-icon {
    width: 40px;
    height: 40px;

    background: #f0eef7;

    border-radius: 9px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 18px;
}

.product-info {
    display: flex;

    flex-direction: column;

    gap: 4px;

    flex: 1;
}

.product-info strong {
    font-size: 13px;
}

.product-info span {
    font-size: 11px;

    color: #999;
}

.quantity {
    font-size: 12px;

    font-weight: bold;
}

.quantity.danger {
    color: #d94a4a;
}


/* =========================
   Responsive
========================= */

@media (max-width: 1100px) {

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 700px) {

    .sidebar {
        width: 70px;

        padding: 20px 10px;
    }

    .logo h2,
    .logo span,
    .sidebar a span {
        display: none;
    }

    .sidebar a {
        justify-content: center;

        font-size: 20px;
    }

    .main {
        margin-right: 70px;

        padding: 20px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 22px;
    }

}
/* =========================
   Products Page
========================= */

.products-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    max-width: 450px;

    height: 45px;

    background: white;
    border: 1px solid #e5e5e5;

    border-radius: 10px;

    display: flex;
    align-items: center;

    padding: 0 14px;

    gap: 10px;
}

.search-box span {
    font-size: 17px;
}

.search-box input {
    border: none;
    outline: none;

    width: 100%;

    font-size: 14px;

    font-family: inherit;
}

.products-controls select {
    height: 45px;

    padding: 0 15px;

    border: 1px solid #e5e5e5;

    border-radius: 10px;

    background: white;

    font-family: inherit;

    font-size: 13px;

    outline: none;

    cursor: pointer;
}

.add-product-btn {
    height: 45px;

    padding: 0 20px;

    border: none;

    border-radius: 10px;

    background: #4b3f72;

    color: white;

    font-family: inherit;

    font-size: 14px;

    cursor: pointer;

    transition: 0.2s;
}

.add-product-btn:hover {
    background: #3d3260;
}


/* Products Panel */

.products-panel {
    padding: 22px;
}

.products-count {
    display: block;

    margin-top: 5px;

    font-size: 12px;

    color: #999;
}


/* Product Table */

#productsTable th {
    white-space: nowrap;
}

#productsTable td {
    vertical-align: middle;
}

#productsTable tbody tr {
    transition: 0.2s;
}

#productsTable tbody tr:hover {
    background: #faf9fd;
}


/* Stock */

.stock-number {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 35px;

    padding: 5px 9px;

    border-radius: 7px;

    background: #edf7ef;

    color: #2d8a4b;

    font-weight: bold;
}

.stock-number.low {
    background: #fff0f0;

    color: #d94a4a;
}


/* Action Buttons */

.action-btn {
    width: 34px;
    height: 34px;

    border-radius: 8px;

    cursor: pointer;

    margin-left: 5px;

    transition: 0.2s;
}

.action-btn.edit {
    background: #f1effa;

    border: 1px solid #ddd7f0;
}

.action-btn.edit:hover {
    background: #e5e1f5;
}

.action-btn.delete {
    background: #fff1f1;

    border: 1px solid #f3d1d1;
}

.action-btn.delete:hover {
    background: #ffe1e1;
}


/* Responsive Products */

@media (max-width: 800px) {

    .products-controls {
        flex-wrap: wrap;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
    }

    .products-controls select {
        flex: 1;
    }

    .add-product-btn {
        flex: 1;
    }

}
/* =========================
   Product Modal
========================= */

.modal-overlay {
    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.45);

    display: none;

    align-items: center;
    justify-content: center;

    z-index: 1000;

    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.product-modal {
    width: 100%;
    max-width: 650px;

    background: white;

    border-radius: 18px;

    padding: 25px;

    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);

    animation: modalOpen 0.2s ease;
}

@keyframes modalOpen {

    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* Modal Header */

.modal-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 25px;
}

.modal-header h2 {
    font-size: 20px;

    margin-bottom: 5px;
}

.modal-header p {
    font-size: 12px;

    color: #999;
}

.close-modal {
    width: 35px;
    height: 35px;

    border: none;

    background: #f5f5f7;

    border-radius: 8px;

    font-size: 24px;

    cursor: pointer;

    color: #555;
}

.close-modal:hover {
    background: #eeeeef;
}


/* Form */

.form-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 18px;
}

.form-group {
    display: flex;

    flex-direction: column;

    gap: 7px;
}

.form-group label {
    font-size: 13px;

    font-weight: bold;

    color: #444;
}

.form-group input,
.form-group select {
    width: 100%;

    height: 44px;

    border: 1px solid #ddd;

    border-radius: 9px;

    padding: 0 12px;

    outline: none;

    font-family: inherit;

    font-size: 13px;

    background: white;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #4b3f72;

    box-shadow: 0 0 0 3px rgba(75, 63, 114, 0.08);
}


/* Modal Actions */

.modal-actions {
    display: flex;

    justify-content: flex-start;

    gap: 10px;

    margin-top: 25px;

    padding-top: 20px;

    border-top: 1px solid #eee;
}

.cancel-btn,
.save-product-btn {
    height: 43px;

    padding: 0 22px;

    border-radius: 9px;

    font-family: inherit;

    font-size: 13px;

    cursor: pointer;
}

.cancel-btn {
    background: #f3f3f5;

    border: none;

    color: #555;
}

.cancel-btn:hover {
    background: #e8e8eb;
}

.save-product-btn {
    background: #4b3f72;

    border: none;

    color: white;
}

.save-product-btn:hover {
    background: #3d3260;
}


/* Mobile Modal */

@media (max-width: 600px) {

    .product-modal {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .cancel-btn,
    .save-product-btn {
        width: 100%;
    }

}
/* =========================
   Sales Page
========================= */

.sales-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    align-items: start;
}


/* Products Search */

.sales-search {
    height: 45px;

    display: flex;
    align-items: center;

    gap: 10px;

    border: 1px solid #e5e5e5;

    border-radius: 10px;

    padding: 0 14px;

    margin-bottom: 18px;

    background: #fff;
}

.sales-search input {
    width: 100%;

    border: none;

    outline: none;

    font-family: inherit;

    font-size: 13px;
}


/* Products List */

.sales-products-list {
    display: flex;

    flex-direction: column;

    gap: 10px;

    max-height: 550px;

    overflow-y: auto;
}

.sales-product {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 13px;

    border: 1px solid #eeeeee;

    border-radius: 10px;

    background: white;

    cursor: pointer;

    transition: 0.2s;
}

.sales-product:hover {
    border-color: #4b3f72;

    background: #faf9fd;
}

.sales-product-icon {
    width: 42px;
    height: 42px;

    border-radius: 9px;

    background: #f0eef7;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 19px;
}

.sales-product-info {
    flex: 1;

    display: flex;

    flex-direction: column;

    gap: 4px;
}

.sales-product-info strong {
    font-size: 13px;
}

.sales-product-info span {
    font-size: 11px;

    color: #999;
}

.sales-product-price {
    text-align: left;
}

.sales-product-price strong {
    display: block;

    font-size: 14px;
}

.sales-product-price span {
    font-size: 11px;

    color: #777;
}


/* Invoice */

.invoice-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 20px;
}

.invoice-header h2 {
    font-size: 18px;

    margin-bottom: 5px;
}

.invoice-header span {
    font-size: 11px;

    color: #999;
}

.new-invoice-btn {
    border: none;

    background: #f1effa;

    color: #4b3f72;

    padding: 9px 13px;

    border-radius: 8px;

    cursor: pointer;

    font-family: inherit;

    font-size: 12px;
}


/* Customer */

.customer-section {
    margin-bottom: 18px;
}

.customer-section label {
    display: block;

    font-size: 12px;

    font-weight: bold;

    margin-bottom: 7px;
}

.customer-section input {
    width: 100%;

    height: 42px;

    border: 1px solid #ddd;

    border-radius: 9px;

    padding: 0 12px;

    outline: none;

    font-family: inherit;
}

.customer-section input:focus {
    border-color: #4b3f72;
}


/* Invoice Items */

.invoice-items {
    min-height: 250px;

    max-height: 350px;

    overflow-y: auto;

    border-top: 1px solid #eee;

    border-bottom: 1px solid #eee;

    padding: 10px 0;
}

.empty-invoice {
    min-height: 230px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    color: #999;

    text-align: center;
}

.empty-invoice div {
    font-size: 35px;

    margin-bottom: 10px;
}

.empty-invoice p {
    font-size: 13px;

    margin-bottom: 5px;
}

.empty-invoice span {
    font-size: 11px;
}


/* Invoice Item */

.invoice-item {
    display: flex;

    align-items: center;

    gap: 10px;

    padding: 12px 5px;

    border-bottom: 1px solid #eee;
}

.invoice-item:last-child {
    border-bottom: none;
}

.invoice-item-info {
    flex: 1;

    display: flex;

    flex-direction: column;

    gap: 4px;
}

.invoice-item-info strong {
    font-size: 12px;
}

.invoice-item-info span {
    font-size: 11px;

    color: #999;
}


/* Quantity */

.quantity-control {
    display: flex;

    align-items: center;

    gap: 7px;
}

.quantity-control button {
    width: 27px;
    height: 27px;

    border: 1px solid #ddd;

    background: #fff;

    border-radius: 6px;

    cursor: pointer;

    font-size: 15px;
}

.quantity-control button:hover {
    background: #f2f1f6;
}

.quantity-control span {
    min-width: 20px;

    text-align: center;

    font-size: 12px;

    font-weight: bold;
}


/* Delete Item */

.remove-item {
    border: none;

    background: #fff1f1;

    color: #d94a4a;

    width: 29px;
    height: 29px;

    border-radius: 7px;

    cursor: pointer;
}


/* Summary */

.invoice-summary {
    padding: 18px 0;

    display: flex;

    flex-direction: column;

    gap: 10px;
}

.invoice-summary div {
    display: flex;

    align-items: center;

    justify-content: space-between;
}

.invoice-summary span {
    font-size: 13px;

    color: #777;
}

.invoice-summary strong {
    font-size: 15px;
}


/* Complete Sale */

.complete-sale-btn {
    width: 100%;

    height: 48px;

    border: none;

    border-radius: 10px;

    background: #4b3f72;

    color: white;

    font-family: inherit;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;

    transition: 0.2s;
}

.complete-sale-btn:hover {
    background: #3d3260;
}

.complete-sale-btn:disabled {
    background: #ccc;

    cursor: not-allowed;
}


/* Responsive */

@media (max-width: 1000px) {

    .sales-layout {
        grid-template-columns: 1fr;
    }

}
/* ==========================================
   Customers
   ========================================== */

.empty-state {
    text-align: center;
    padding: 40px;
    color: #777;
    font-size: 16px;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 550px;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    border: none;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
    color: #777;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px;
    border: 1px solid #ddd;
    border-radius: 7px;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #777;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 25px;
}

.primary-btn,
.secondary-btn {
    border: none;
    padding: 11px 20px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 14px;
}

.secondary-btn {
    background: #eee;
    color: #333;
}

.edit-btn,
.delete-btn {
    border: none;
    padding: 7px 12px;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 5px;
}

.edit-btn {
    background: #eee;
}

.delete-btn {
    background: #f5d6d6;
    color: #a00;
}

.debt {
    color: #c00;
    font-weight: bold;
}

.paid {
    color: #16803c;
    font-weight: bold;
}

.search-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 7px;
    font-size: 15px;
}
/* السماح بالتمرير في لوحة التحكم */
html,
body {
    min-height: 100%;
}

body {
    overflow-y: auto;
}

.sidebar {
    height: 100vh;
    overflow-y: auto;
}

.main {
    min-height: 100vh;
    overflow: visible;
}
.main {
    min-height: 100vh;
    overflow: visible;
}
.account-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.account-modal.show {
    display: flex;
}

.account-modal-content {
    width: 100%;
    max-width: 500px;
    background: #fff;
    border-radius: 18px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.account-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.account-modal-header h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.account-modal-header p {
    margin: 0;
    color: #777;
}

.account-modal-close {
    border: none;
    background: #f3f1f8;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 24px;
    cursor: pointer;
}

.supplier-current-balance {
    background: #f7f5fb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.supplier-current-balance span {
    color: #666;
}

.supplier-current-balance strong {
    font-size: 22px;
}

.account-form-group {
    margin-bottom: 16px;
}

.account-form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: bold;
}

.account-form-group select,
.account-form-group input,
.account-form-group textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border: 1px solid #ddd;
    border-radius: 9px;
    font-family: inherit;
    font-size: 14px;
}

.account-form-group textarea {
    resize: vertical;
}

.account-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.account-modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
}

.account-cancel-btn {
    background: #eee;
}

.account-save-btn {
    background: #4f3f7d;
    color: #fff;
}

.account-action-btn {
    padding: 7px 10px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
}