/* لوحة تحكم بِن — تصميم احترافي بهوية القهوة (RTL) */
:root {
  --espresso: #3e2723;
  --coffee: #6f4e37;
  --caramel: #c8893f;
  --gold: #b87333;
  --sage: #5b7c4d;
  --cream: #f8f2e9;
  --surface: #ffffff;
  --ink: #2b211d;
  --muted: #8a7b72;
  --line: #eadfd0;
  --danger: #c0392b;
  --blue: #2d6cdf;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(62, 39, 35, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== التخطيط ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, var(--espresso), #2c1c18);
  color: #fff;
  padding: 24px 16px;
  position: fixed;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 8px 24px;
}
.brand .logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--caramel);
  display: grid; place-items: center; font-size: 22px;
}
.brand h1 { font-size: 22px; }
.brand span { font-size: 12px; color: rgba(255,255,255,.6); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  color: rgba(255,255,255,.8); font-size: 15px; font-weight: 600;
  transition: .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--caramel); color: #fff; }
.nav .ico { font-size: 18px; width: 22px; text-align: center; }

.sidebar .foot { margin-top: auto; }
.sidebar .foot a {
  display: block; padding: 12px 14px; border-radius: 12px;
  color: rgba(255,255,255,.7); font-size: 14px;
}
.sidebar .foot a:hover { background: rgba(255,255,255,.08); color: #fff; }

.main {
  flex: 1;
  margin-inline-start: 250px;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-size: 20px; }
.topbar .user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.topbar .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--caramel); color: #fff;
  display: grid; place-items: center; font-weight: bold;
}
.content { padding: 28px; }

/* ===== البطاقات والإحصاءات ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.stat .icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px; color: #fff;
}
.stat .num { font-size: 24px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; }

.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px;
}
.card h3 { font-size: 17px; margin-bottom: 16px; }

/* ===== الجداول ===== */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: right; font-size: 14px; }
th { color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--line); }
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--cream); }

/* ===== الشارات ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.badge-PLACED { background: rgba(200,137,63,.15); color: var(--caramel); }
.badge-PREPARING { background: rgba(184,115,51,.15); color: var(--gold); }
.badge-ONWAY { background: rgba(45,108,223,.15); color: var(--blue); }
.badge-DELIVERED { background: rgba(91,124,77,.15); color: var(--sage); }
.badge-CANCELLED { background: rgba(192,57,43,.12); color: var(--danger); }
.badge-on { background: rgba(91,124,77,.15); color: var(--sage); }
.badge-off { background: rgba(138,123,114,.15); color: var(--muted); }

/* ===== الأزرار ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; border: none;
  background: var(--espresso); color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: .15s; font-family: inherit;
}
.btn:hover { opacity: .92; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-gold { background: var(--caramel); }
.btn-ghost { background: var(--cream); color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h2 { font-size: 22px; }

/* ===== النماذج ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { margin-bottom: 16px; }
.field.full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
input, select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-family: inherit;
  font-size: 14px; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--caramel); border-color: transparent; }
textarea { resize: vertical; min-height: 90px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.img-list { display: flex; flex-wrap: wrap; gap: 12px; }
.img-item { position: relative; width: 84px; }
.img-item img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; }
.img-item label { position: absolute; top: 4px; inset-inline-start: 4px; background: rgba(0,0,0,.5); color: #fff; padding: 2px 6px; border-radius: 8px; font-size: 11px; }

/* ===== تسجيل الدخول ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, var(--espresso), var(--coffee)); }
.login-card { background: #fff; border-radius: 24px; padding: 36px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--espresso); color: #fff; display: grid; place-items: center; font-size: 32px; margin: 0 auto 16px; }
.login-card h1 { text-align: center; font-size: 24px; }
.login-card p { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.alert { background: rgba(192,57,43,.1); color: var(--danger); padding: 12px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; text-align: center; }
.full-w { width: 100%; justify-content: center; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }
.tag { display:inline-block; padding:2px 8px; background:var(--cream); border:1px solid var(--line); border-radius:8px; font-size:12px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .sidebar { width: 70px; }
  .brand h1, .brand span, .nav a span, .sidebar .foot a span { display: none; }
  .main { margin-inline-start: 70px; }
}
