@font-face { font-family: 'Plex Arabic'; src: url('../fonts/plex-ar-400.woff2') format('woff2'); font-weight: 400; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('../fonts/plex-ar-600.woff2') format('woff2'); font-weight: 600; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('../fonts/plex-ar-700.woff2') format('woff2'); font-weight: 700; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('../fonts/plex-lat-400.woff2') format('woff2'); font-weight: 400; unicode-range: U+0000-024F, U+2000-206F, U+20AC; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('../fonts/plex-lat-600.woff2') format('woff2'); font-weight: 600; unicode-range: U+0000-024F, U+2000-206F, U+20AC; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('../fonts/plex-lat-700.woff2') format('woff2'); font-weight: 700; unicode-range: U+0000-024F, U+2000-206F, U+20AC; font-display: swap; }

:root {
  --navy: #1F3864; --navy-2: #2F5597; --navy-soft: #E7EDF7;
  --green: #2E7D32; --green-soft: #E8F5E9; --green-soft-2: #DAEEDC;
  --orange: #D9771E; --orange-soft: #FDF0E2;
  --red: #C62828; --red-soft: #FDECEC;
  --bg: #F3F5F9; --card: #FFFFFF; --line: #DCE2EA; --line-2: #EDF0F5;
  --text: #1A2233; --muted: #6B7689; --zebra: #F7F9FC;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: 'Plex Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-2); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* buttons & inputs */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--zebra); border-color: #C5CEDB; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #276B2B; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: #F1B9B9; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; }
.input, select.input, textarea.input { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; outline: none; width: 100%; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(47,85,151,.15); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-navy { background: var(--navy-soft); color: var(--navy); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-gray { background: var(--line-2); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #B8C1CF; display: inline-block; }
.dot.on { background: #22A447; box-shadow: 0 0 0 3px rgba(34,164,71,.18); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; color: var(--navy); }
.card-body { padding: 16px 18px; }

/* tables */
.table-wrap { overflow: auto; border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid th { position: sticky; top: 0; z-index: 2; background: var(--navy); color: #fff; font-weight: 600; text-align: right; padding: 10px 12px; white-space: nowrap; font-size: 12.5px; }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.grid tbody tr:nth-child(even) td { background: var(--zebra); }
table.grid tbody tr:hover td { background: #EEF3FB; }

/* toast */
#toasts { position: fixed; bottom: 20px; left: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-weight: 600; font-size: 13px; animation: tin .2s ease-out; max-width: 380px; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 900; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: tin .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--navy); }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-start; }
.modal-foot .btn-danger { margin-inline-start: auto; }

/* copy protection */
body.no-copy, body.no-copy * { -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; }
body.no-copy input, body.no-copy textarea { -webkit-user-select: text !important; user-select: text !important; }
.watermark { position: fixed; inset: 0; pointer-events: none; z-index: 50; background-repeat: repeat; opacity: 1; }
@media print { body.no-copy * { display: none !important; } body.no-copy::after { content: 'الطباعة غير مسموحة'; display: block; padding: 40px; font-size: 20px; } }

/* one soft colour per price column, a deeper tone of it for the column title
   P1 sky · P2 grey · P3 $ beige · P4 $ lavender · P3 dinar light green · P4 dinar deeper green */
.k-p1 { --k-bg: #E4F3FA; --k-head: #3E93B9; --k-ink: #0E4F6B; }
.k-p2 { --k-bg: #EDEFF2; --k-head: #6E7887; --k-ink: #2E3643; }
.k-p3_usd { --k-bg: #F5EDDD; --k-head: #A5865A; --k-ink: #5A4220; }
.k-p4_usd { --k-bg: #EEE9F6; --k-head: #7D6AA6; --k-ink: #3E2F63; }
.k-p3_lyd { --k-bg: #E5F3E6; --k-head: #4E9F52; --k-ink: #1B5E20; }
.k-p4_lyd { --k-bg: #CDE7CF; --k-head: #2E7D32; --k-ink: #124716; }
.k-cost { --k-bg: #FFF4D6; --k-head: #8A6D1A; --k-ink: #6B5310; }
.k-qty { --k-bg: #F4F6F9; --k-head: #5B6577; --k-ink: #1A2233; }

/* WhatsApp button and availability badges (customer page and admin) */
.btn-wa { background: #1E8E4E; border-color: #1E8E4E; color: #fff; }
.btn-wa:hover { background: #18773F; border-color: #18773F; }
.av { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px 1px 7px; line-height: 1.6; white-space: nowrap; vertical-align: middle; }
.av::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.av-in { background: var(--green-soft); color: #1F7A3A; }
.av-low { background: var(--orange-soft); color: #B35C0C; }
.av-out { background: var(--red-soft); color: var(--red); }
.av.av-dot { padding: 0; background: none; width: 9px; height: 9px; justify-content: center; }
.av.av-dot::before { width: 9px; height: 9px; background: #2E9E4F; }
