:root {
  --primary: #b91c1c;
  --primary-dark: #8f1616;
  --bg: #f7f5f4;
  --card-bg: #ffffff;
  --border: #e7e1df;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #b91c1c, #4c1616);
}

.login-box {
  background: #fff;
  padding: 32px 28px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  text-align: center;
}

.login-box h1 { margin: 0 0 4px; font-size: 22px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-box form { text-align: right; }
.login-box label { display: block; margin: 12px 0 4px; font-size: 14px; color: var(--muted); }
.login-box input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 15px;
}
.login-box button {
  width: 100%; margin-top: 20px; padding: 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 16px; cursor: pointer;
}
.login-box .error { background: #fee2e2; color: var(--danger); padding: 8px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--primary); color: #fff; padding: 14px 18px; position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 600; font-size: 17px; }
.user-area { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.user-area .logout { color: #fff; text-decoration: none; background: rgba(255,255,255,0.15); padding: 6px 12px; border-radius: 6px; }

.tabs {
  display: flex; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 52px; z-index: 19; -webkit-overflow-scrolling: touch;
}
.tab-btn {
  flex: 0 0 auto; padding: 12px 16px; background: none; border: none; font-size: 14px; color: var(--muted);
  cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.badge {
  background: var(--warn); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-right: 4px;
}

main { max-width: 950px; margin: 0 auto; padding: 16px; padding-bottom: 60px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.card h3 { margin-top: 0; }

.hint { color: var(--muted); font-size: 13.5px; margin-top: 0; }

textarea, input[type=text], input[type=tel], input[type=date], input[type=time], input[type=number], select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; }

.btn-primary, .btn-secondary {
  border: none; border-radius: 8px; padding: 11px 18px; font-size: 15px; cursor: pointer; margin-top: 10px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f1ebe9; color: var(--text); margin-left: 8px; }
.btn-danger { background: #fee2e2; color: var(--danger); border: none; border-radius: 6px; padding: 6px 10px; cursor: pointer; }

.loading { color: var(--muted); font-size: 14px; margin-top: 10px; }
.hidden { display: none !important; }

.field-row { margin-bottom: 10px; }
.field-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .field-grid { grid-template-columns: 1fr; } }

.data-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: right; vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 13px; }

.toast {
  position: fixed; bottom: 20px; right: 20px; left: 20px; max-width: 400px; margin: 0 auto;
  background: #1f2937; color: #fff; padding: 12px 18px; border-radius: 10px; text-align: center;
  font-size: 14px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

.status-pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-confirmed { background: #dbeafe; color: #1e40af; }
.status-preparing { background: #fde68a; color: #92400e; }
.status-ready { background: #d1fae5; color: #065f46; }
.status-out_for_delivery { background: #e0e7ff; color: #3730a3; }
.status-completed { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.item-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
}
.item-card .item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-card .item-name { font-weight: 600; }
.item-card .item-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.item-card .item-order-lines { margin-top: 8px; font-size: 14px; line-height: 1.7; }

.setup-step { border-right: 3px solid var(--border); padding: 4px 14px 4px 0; margin-bottom: 14px; }
.setup-step.done { border-right-color: var(--success); }
.code-box {
  background: #1f2937; color: #e5e7eb; padding: 10px 12px; border-radius: 8px; font-family: monospace;
  font-size: 13px; overflow-x: auto; direction: ltr; text-align: left;
}
