body {
    font-family: Tahoma, Arial, sans-serif;
    background: #f6f8fb;
    margin: 0;
    padding: 0;
}

.page-wrapper {
    padding: 20px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
}

.card-box {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    margin-bottom: 20px;
}

.filters-grid,
.entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

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

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

.form-control {
    height: 40px;
    border: 1px solid #d9dfe7;
    border-radius: 8px;
    padding: 0 10px;
    outline: none;
    background: #fff;
}

textarea.form-control {
    height: 80px;
    padding: 10px;
    resize: vertical;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: bold;
}

.btn-primary {
    background: #0d6efd;
    color: #fff;
}

.btn-success {
    background: #198754;
    color: #fff;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

table th,
table td {
    padding: 10px;
    border-bottom: 1px solid #eef1f5;
    text-align: right;
    font-size: 14px;
    vertical-align: middle;
}

table th {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.badge-posted {
    background: #d1e7dd;
    color: #0f5132;
}

.badge-draft {
    background: #fff3cd;
    color: #664d03;
}

.badge-reversed {
    background: #f8d7da;
    color: #842029;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 1200px;
    max-height: 92vh;
    overflow: auto;
    padding: 20px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.lines-table table {
    min-width: 1100px;
}

.line-actions {
    display: flex;
    gap: 6px;
}

.totals-box {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    font-weight: bold;
}

.alert-box {
    display: none;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: bold;
}

.alert-success {
    background: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background: #f8d7da;
    color: #842029;
}

.details-box {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    margin-top: 12px;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 18px;
}

.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
    border: 1px solid #eef2f7;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.6;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

/* تابلت */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* موبايل */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: auto;
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 520px;
    border-radius: 14px;
}

.table-responsive table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
}

.table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
}

.journal-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.table-meta {
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination button {
    min-width: 38px;
    height: 38px;
    border: 1px solid #d7dce3;
    background: #fff;
    color: #333;
    border-radius: 10px;
    cursor: pointer;
    padding: 0 12px;
    font-weight: 700;
    transition: .2s ease;
}

.pagination button:hover {
    background: #f3f6fa;
}

.pagination button.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.pagination button:disabled {
    opacity: .5;
    cursor: not-allowed;
}