:root {
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #18a058;
    --danger: #dc3545;
    --warning: #f59e0b;
    --info: #2563eb;
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    direction: rtl;
    background: var(--bg);
    color: var(--text);
    padding-bottom: 84px;
}

a {
    color: inherit;
    text-decoration: none;
}

.mobile-shell {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: white;
    padding: 16px 18px;
    border-bottom-left-radius: 22px;
    border-bottom-right-radius: 22px;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.22);
}

.topbar-title {
    font-weight: 700;
    font-size: 18px;
}

.topbar-subtitle {
    font-size: 12px;
    opacity: .85;
    margin-top: 4px;
}

.content {
    padding: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
    margin-bottom: 14px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.metric {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .04);
}

.metric .num {
    font-size: 24px;
    color: var(--primary);
    font-weight: bold;
}

.metric .label {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

.form-group {
    margin-bottom: 13px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 7px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    font-family: inherit;
    font-size: 15px;
    background: #fff;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 13px;
    padding: 12px 14px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #eef2ff;
    color: #1e40af;
}

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

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

.row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-received { background: #f3f4f6; color: #374151; }
.badge-washing { background: #dbeafe; color: #1d4ed8; }
.badge-ready { background: #dcfce7; color: #15803d; }
.badge-delivered { background: #111827; color: #fff; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-paid { background: #dcfce7; color: #15803d; }
.badge-partial { background: #fef3c7; color: #92400e; }
.badge-unpaid { background: #fee2e2; color: #b91c1c; }

.list-item {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
}

.list-title {
    font-weight: 800;
    margin-bottom: 4px;
}

.list-meta {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.amount-green { color: var(--success); font-weight: 800; }
.amount-red { color: var(--danger); font-weight: 800; }
.amount-blue { color: var(--primary); font-weight: 800; }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 520px;
    width: 100%;
    background: white;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 8px 6px 10px;
    z-index: 20;
}

.bottom-nav a {
    text-align: center;
    color: var(--muted);
    font-size: 10px;
    padding: 6px 1px;
}

.bottom-nav .active {
    color: var(--primary);
    font-weight: bold;
}

.alert {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.error-text {
    color: var(--danger);
    font-size: 12px;
    margin-top: 5px;
}

.search-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.search-box .btn {
    width: auto;
    padding-inline: 18px;
}

.filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.filters a {
    white-space: nowrap;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 13px;
}

.filters a.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.table-like-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    gap: 12px;
}

.table-like-row:last-child {
    border-bottom: 0;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo .icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: linear-gradient(135deg, #0d6efd, #63a4ff);
    color: white;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
}

.login-logo h1 {
    margin: 0;
    color: #0d47a1;
}

@media (min-width: 700px) {
    body {
        background: #dbeafe;
    }

    .mobile-shell {
        border-left: 1px solid rgba(0,0,0,.08);
        border-right: 1px solid rgba(0,0,0,.08);
    }
}


.sale-product-row {
    display: grid;
    grid-template-columns: 1fr 90px;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}

.quantity-input {
    text-align: center;
    font-weight: 800;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.section-head h3 {
    margin: 0 0 4px;
}

.section-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.quick-count-badge {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
    padding: 7px 10px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 13px;
}

.quick-products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.quick-product-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px;
    background: #fff;
    min-height: 188px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    transition: .15s ease;
}

.quick-product-card.selected {
    border-color: var(--primary);
    background: #f0f7ff;
    box-shadow: 0 10px 20px rgba(13, 110, 253, .10);
}

.quick-product-name {
    font-weight: 900;
    color: #111827;
    line-height: 1.35;
}

.quick-product-price,
.quick-product-stock {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.quick-qty-control {
    margin-top: auto;
    display: grid;
    grid-template-columns: 42px 1fr 42px;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    font-size: 24px;
    font-weight: 900;
    cursor: pointer;
}

.plus-btn {
    background: var(--primary);
    color: #fff;
}

.minus-btn {
    background: #eef2f7;
    color: #111827;
}

.qty-display {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    font-size: 20px;
}

.quick-line-total {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px dashed var(--border);
    padding-top: 8px;
}

.quick-line-total strong {
    color: #166534;
}

.total-preview-card {
    background: #f8fbff;
    margin: 6px 0 16px;
    box-shadow: none;
}

@media (max-width: 360px) {
    .quick-products-grid {
        grid-template-columns: 1fr;
    }
}


.quick-product-card.out-of-stock {
    opacity: .72;
    background: #f9fafb;
}

.quick-product-card.out-of-stock .plus-btn {
    background: #cbd5e1;
    cursor: not-allowed;
}

.quick-stock-warning {
    display: inline-flex;
    width: fit-content;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 800;
}
