/* ===== لوحة تحكم راحتكم ===== */
:root {
  --navy-900: #060912; --navy-800: #0B1020; --navy-700: #131a30; --navy-600: #1c2543;
  --paper: #fff; --cloud: #f6f8fc; --cloud-2: #eef2f9; --line: #e3e8f1; --muted: #6b7488; --text: #1b2233;
  --ink: #0B1020; --gold-500: #d4af61; --gold-600: #b8923f; --gold-grad: linear-gradient(135deg,#f3dfa9,#d4af61,#b8923f);
  --teal: #2bb6a3; --danger: #e05b5b; --shadow-sm: 0 2px 10px rgba(11,16,32,.06); --shadow-md: 0 14px 40px rgba(11,16,32,.1);
  --font: 'Tajawal','Cairo',system-ui,sans-serif;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: var(--font); background: var(--cloud); color: var(--text); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
h1,h2,h3,h4 { font-family: 'Cairo', var(--font); color: var(--ink); }

.layout { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar { background: var(--navy-800); color: #cfd6e6; padding: 26px 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sb-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 26px; margin-bottom: 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--gold-grad); display: grid; place-items: center; color: #2a2005; }
.sb-mark svg { width: 24px; height: 24px; }
.sb-brand .nm { font-family:'Cairo'; font-weight: 800; font-size: 1.2rem; color: #fff; }
.sb-brand .nm span { color: var(--gold-500); }
.sb-brand small { color: #8b95ac; font-size: .72rem; display: block; }
.sb-label { font-size: .72rem; color:#727d97; text-transform: uppercase; letter-spacing: 1px; margin: 20px 8px 10px; font-weight: 700; }
.sb-link { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 12px; color: #b6c0d6; font-weight: 600; font-size: .96rem; margin-bottom: 4px; transition: .2s; cursor: pointer; }
.sb-link svg { width: 20px; height: 20px; }
.sb-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-link.active { background: var(--gold-grad); color: #2a2005; }
.sb-badge { margin-right: auto; background: var(--teal); color: #fff; font-size: .72rem; padding: 1px 8px; border-radius: 999px; font-weight: 800; }
.sb-link.active .sb-badge { background: rgba(0,0,0,.2); }
.sb-foot { margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.08); }

/* Main */
.main { padding: 0; overflow: hidden; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 1.5rem; }
.topbar .sub { color: var(--muted); font-size: .9rem; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-ava { width: 42px; height: 42px; border-radius: 12px; background: var(--navy-700); color: var(--gold-500); display: grid; place-items: center; font-weight: 800; }
.admin-user b { display: block; font-size: .92rem; }
.admin-user small { color: var(--muted); font-size: .78rem; }
.hamb { display: none; width: 42px; height: 42px; border-radius: 10px; background: var(--cloud); place-items: center; }

.content { padding: 30px 32px; }
.view { display: none; }
.view.active { display: block; animation: fade .3s; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; margin-bottom: 28px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; position: relative; overflow: hidden; }
.stat .ic { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 16px; }
.stat .ic svg { width: 24px; height: 24px; }
.stat.c1 .ic { background: rgba(212,175,97,.15); color: var(--gold-600); }
.stat.c2 .ic { background: rgba(43,182,163,.15); color: var(--teal); }
.stat.c3 .ic { background: rgba(90,110,240,.15); color: #5a6ef0; }
.stat.c4 .ic { background: rgba(224,91,91,.14); color: var(--danger); }
.stat .val { font-family: 'Cairo'; font-size: 1.9rem; font-weight: 800; color: var(--ink); }
.stat .lbl { color: var(--muted); font-size: .9rem; }
.stat .trend { position: absolute; top: 22px; left: 22px; font-size: .78rem; font-weight: 700; color: var(--teal); background: rgba(43,182,163,.12); padding: 3px 9px; border-radius: 999px; }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; margin-bottom: 24px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.card-head h3 { font-size: 1.15rem; }
.card-head .link { color: var(--gold-600); font-weight: 700; font-size: .88rem; cursor: pointer; }

/* Bars */
.bar-row { margin-bottom: 16px; }
.bar-row .bl { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 6px; }
.bar-row .bl b { font-weight: 700; }
.bar { height: 9px; background: var(--cloud-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold-grad); border-radius: 999px; transition: width .8s; }
.bar.teal span { background: linear-gradient(90deg,#2bb6a3,#1a8b7c); }

/* status donut list */
.status-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.status-list li:last-child { border: 0; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; }
.status-list li b { margin-right: auto; }

/* Table */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.table-head { padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--line); }
.table-head h3 { font-size: 1.2rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 20px; text-align: right; font-size: .92rem; }
th { background: var(--cloud); color: var(--muted); font-weight: 700; font-size: .82rem; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfcfe; }
.t-prod { display: flex; align-items: center; gap: 12px; }
.t-prod img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; }
.t-prod b { font-weight: 700; font-size: .9rem; }
.pill { padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; display: inline-block; white-space: nowrap; }
.pill.new { background: #eef1fd; color: #5a6ef0; }
.pill.prep { background: #fff5e6; color: #c9862a; }
.pill.ship { background: #e8f6fd; color: #2a8bc9; }
.pill.done { background: #e7f7f2; color: #1a8b7c; }
.pill.cancel { background: #fdecec; color: var(--danger); }
.pill.mini { background: var(--cloud); color: var(--text); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 11px; font-weight: 700; font-size: .9rem; transition: .2s; }
.btn svg { width: 17px; height: 17px; }
.btn-gold { background: var(--gold-grad); color: #2a2005; }
.btn-gold:hover { box-shadow: 0 8px 20px rgba(184,146,63,.35); transform: translateY(-2px); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { border: 1.5px solid var(--line); color: var(--ink); background: #fff; }
.btn-outline:hover { border-color: var(--gold-500); color: var(--gold-600); }
.btn-sm { padding: 8px 14px; font-size: .84rem; }
.icon-act { width: 34px; height: 34px; border-radius: 9px; background: var(--cloud); display: inline-grid; place-items: center; color: var(--muted); transition: .2s; }
.icon-act:hover { background: var(--cloud-2); color: var(--ink); }
.icon-act.del:hover { background: #fdecec; color: var(--danger); }
.icon-act svg { width: 17px; height: 17px; }
.row-acts { display: flex; gap: 8px; }
.select-status { padding: 7px 12px; border-radius: 9px; border: 1.5px solid var(--line); font-family: inherit; font-size: .84rem; cursor: pointer; }

/* Login gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(120% 120% at 80% 0%, #1c2543, #0B1020 60%, #060912); }
.gate-card { background: #fff; border-radius: 22px; padding: 44px 40px; width: 100%; max-width: 420px; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.gate-card .sb-mark { margin: 0 auto 18px; width: 56px; height: 56px; }
.gate-card h2 { text-align: center; font-size: 1.5rem; }
.gate-card p { text-align: center; color: var(--muted); margin: 6px 0 26px; font-size: .92rem; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 7px; }
.form-control { width: 100%; padding: 12px 15px; border-radius: 11px; border: 1.5px solid var(--line); font-family: inherit; font-size: .95rem; transition: .2s; }
.form-control:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 4px rgba(212,175,97,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.alert { padding: 11px 15px; border-radius: 11px; font-size: .88rem; font-weight: 600; margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert.err { background: #fdecec; color: #b93838; }
.alert.ok { background: #e7f7f2; color: #1a8b7c; }
.demo-creds { background: var(--cloud); border: 1px dashed var(--line); border-radius: 12px; padding: 13px 16px; font-size: .82rem; color: var(--muted); margin-top: 18px; text-align: center; }
.demo-creds b { color: var(--ink); }

/* Modal */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; opacity: 0; visibility: hidden; transition: .25s; }
.modal-wrap.open { opacity: 1; visibility: visible; }
.modal-wrap .backdrop { position: absolute; inset: 0; background: rgba(6,9,18,.6); backdrop-filter: blur(4px); }
.modal { position: relative; background: #fff; border-radius: 20px; width: 100%; max-width: 560px; padding: 32px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-md); transform: translateY(20px); transition: .3s; }
.modal-wrap.open .modal { transform: none; }
.modal h3 { font-size: 1.35rem; margin-bottom: 20px; }
.modal-close { position: absolute; top: 16px; left: 16px; width: 36px; height: 36px; border-radius: 10px; background: var(--cloud); display: grid; place-items: center; }

.toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 12px; box-shadow: var(--shadow-md); display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: .9rem; animation: slin .3s; }
.toast svg { width: 19px; height: 19px; color: #40d3ac; }
@keyframes slin { from { transform: translateY(20px); opacity: 0; } }

.empty-state { text-align: center; padding: 50px; color: var(--muted); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 268px; transform: translateX(100%); transition: .3s; right: 0; }
  .sidebar.open { transform: translateX(0); }
  .hamb { display: grid; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 20px 16px; }
  .topbar { padding: 16px 18px; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 640px; }
}
