:root {
  --bg: #0b1020; --bg2: #0f1535; --card: #161b34; --line: #232a4f;
  --text: #ecf0ff; --muted: #9aa3b8; --accent: #ff5a3c; --accent2: #ffb74d;
  --green: #16c97b; --red: #e54848; --blue: #3b82f6; --purple: #7c5cff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  font-family: 'Cairo', 'Tajawal', -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
}
[dir="rtl"] body { font-family: 'Cairo', 'Tajawal', -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif; }
.screen { padding: 22px; min-height: 100vh; }
.hidden { display: none !important; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.muted { color: var(--muted); }
.card { background: var(--card); border-radius: 18px; padding: 22px; margin-bottom: 14px; }
.login-card { max-width: 460px; margin: 60px auto; }
form label { display: block; margin: 12px 0; font-size: 13px; color: var(--muted); }
form input, form select { display: block; width: 100%; padding: 12px 14px; margin-top: 6px; background: #0f1430; color: #fff; border: 1px solid var(--line); border-radius: 12px; font: inherit; }
button { font: inherit; border: none; border-radius: 12px; padding: 12px 16px; cursor: pointer; color: #fff; background: var(--blue); }
button.primary { background: var(--accent); font-weight: 700; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.small { padding: 6px 10px; font-size: 13px; }
.error { color: var(--red); margin-top: 10px; font-size: 13px; min-height: 18px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: #0e1530; border-radius: 18px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 10px; padding: 8px 12px; }
.tab.active { color: #fff; border-color: var(--line); background: #11183a; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.branch-picker { background: #0f1430; color: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font: inherit; }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.row input, .row select { flex: 1; min-width: 180px; padding: 10px 14px; background: #0f1430; border: 1px solid var(--line); color: #fff; border-radius: 12px; font: inherit; }
h2 { margin: 8px 0; }
h3 { margin: 4px 0 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: #0f1430; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 4px; }
.table { width: 100%; border-collapse: collapse; background: #0f1430; border-radius: 14px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
[dir="rtl"] .table th, [dir="rtl"] .table td { text-align: right; }
.table th { color: var(--muted); font-weight: 500; background: #0d122b; }
.table tbody tr:hover { background: #0d1432; cursor: pointer; }
.chip { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.chip-pending { background: rgba(255,90,60,.15); color: var(--accent); }
.chip-preparing { background: rgba(124,92,255,.18); color: var(--purple); }
.chip-on-the-way, .chip-on { background: rgba(59,130,246,.18); color: var(--blue); }
.chip-delivered { background: rgba(22,201,123,.18); color: var(--green); }
.chip-rejected, .chip-cancelled { background: rgba(229,72,72,.18); color: var(--red); }
.chip-waiting-for-courier { background: rgba(255,183,77,.18); color: var(--accent2); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.picker { background: #0f1430; border: 1px solid var(--line); padding: 16px; border-radius: 14px; text-align: center; font-weight: 600; }
.picker.selected { border-color: var(--accent); background: rgba(255,90,60,.08); }
.code { background: #0a0f24; color: #b8e1ff; padding: 14px; border-radius: 12px; overflow-x: auto; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; font-family: 'Menlo', 'Consolas', monospace; font-size: 12px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 14px; }
.modal-card { background: var(--card); border-radius: 18px; padding: 22px; max-width: 700px; width: 100%; max-height: 90vh; overflow-y: auto; }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.stepper button { padding: 10px 14px; background: #0f1430; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }
.stepper button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.action-bar { display: flex; gap: 6px; flex-wrap: wrap; }
a { color: var(--accent); text-decoration: none; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 14px; margin: 12px 0; }
.kv .k { color: var(--muted); }
@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 10px; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .kv { grid-template-columns: 1fr; }
  .kv .v { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
}
