@import url(../../_shared/fonts.css);
:root {
  --bg: #F4F3EE; --surface: #fff; --ink: #1D2112; --muted: #6F735E; --line: #E7E5DA; --soft: #F7F6F1;
  --accent: #3E4A22; --accent-2: #C9A24B; --deep: #1C2210; --ok: #16A34A; --warn: #D97706; --err: #DC2626; --info: #2563EB;
  --r: 16px; --shadow: 0 1px 2px rgba(29,33,18,.05), 0 6px 20px -10px rgba(29,33,18,.15);
  --f: 'IBM Plex Sans Arabic', system-ui, sans-serif; --num: 'Inter', 'IBM Plex Sans Arabic', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14.5px/1.6 var(--f); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
.num { font-family: var(--num); font-feature-settings: 'tnum'; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.ic { display: inline-flex; flex: none; }
.mk { display: block; } .mk svg { width: 100%; height: 100%; display: block; }

.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
aside.side { background: var(--deep); color: #E9E6D8; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 24px; }
.brand .mk { width: 34px; height: 34px; color: #F6F0E1; --cream: var(--deep); }
.brand b { font: 700 21px/1 'El Messiri', serif; display: block; }
.brand span { font-size: 11.5px; opacity: .55; }
.nav-sec { font-size: 11px; letter-spacing: .08em; opacity: .45; padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; opacity: .78; transition: .15s; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); opacity: 1; }
.nav a.on { background: #F6F0E1; color: var(--deep); opacity: 1; }
.nav a .cnt { margin-inline-start: auto; background: var(--accent-2); color: var(--deep); font: 700 11px/18px var(--num); min-width: 22px; text-align: center; border-radius: 9px; padding: 0 6px; }
.side-foot { margin-top: auto; padding: 14px 12px; border-radius: 14px; background: rgba(255,255,255,.05); font-size: 12.5px; }
.side-foot b { display: block; font-size: 13.5px; }
.side-foot button { margin-top: 10px; color: var(--accent-2); font-weight: 600; font-size: 12.5px; }

main.content { padding: 0 32px 50px; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; height: 76px; position: sticky; top: 0; background: rgba(244,243,238,.9); backdrop-filter: blur(10px); z-index: 20; margin: 0 -32px 6px; padding: 0 32px; border-bottom: 1px solid transparent; }
.search { flex: 1; max-width: 420px; position: relative; }
.search input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 42px 0 14px; }
.search .ic { position: absolute; right: 14px; top: 12px; color: var(--muted); }
.top .sp { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 500; font-size: 13.5px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #F6F0E1; display: grid; place-items: center; font-weight: 700; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); position: relative; }
.dot-badge { position: absolute; top: 8px; left: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); box-shadow: 0 0 0 2px #fff; }

.ph { display: flex; justify-content: space-between; align-items: flex-end; margin: 18px 0 22px; gap: 16px; flex-wrap: wrap; }
.ph h1 { font: 700 28px/1.2 var(--f); margin: 0; }
.ph p { margin: 4px 0 0; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: .15s; white-space: nowrap; }
.btn-p { background: var(--accent); color: #F6F0E1; } .btn-p:hover { background: #313b1a; }
.btn-o { background: var(--surface); border: 1px solid var(--line); } .btn-o:hover { background: var(--soft); }
.btn-g { background: var(--accent-2); color: var(--deep); }
.btn-d { background: #FEF2F2; color: var(--err); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 6px; gap: 10px; }
.card-h h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card-b { padding: 12px 20px 20px; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi .lbl .ic-b { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--soft); color: var(--accent); }
.kpi .val { font: 700 26px/1.2 var(--num); margin: 12px 0 6px; direction: ltr; text-align: right; }
.kpi .val small { font: 600 13px var(--f); color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px var(--num); padding: 2px 8px; border-radius: 999px; direction: ltr; }
.trend.up { color: var(--ok); background: #ECFDF3; } .trend.down { color: var(--err); background: #FEF2F2; }
.kpi .spark { position: absolute; left: 14px; bottom: 14px; opacity: .9; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 16px; }
.chart { color: var(--ink); display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-wrap ul { list-style: none; margin: 0; padding: 0; flex: 1; font-size: 13px; }
.donut-wrap li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.donut-wrap li b { margin-inline-start: auto; font-family: var(--num); }
.donut-wrap li i { width: 9px; height: 9px; border-radius: 50%; }
.tp { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.tp:last-child { border: 0; }
.tp .th { width: 44px; height: 44px; border-radius: 12px; background: #F3EEDF; display: grid; place-items: center; flex: none; }
.tp .th svg { height: 86%; width: auto; }
.tp b { display: block; font-size: 14px; font-weight: 600; }
.tp .r { margin-inline-start: auto; text-align: left; }
.bar-mini { height: 5px; border-radius: 3px; background: var(--soft); margin-top: 5px; overflow: hidden; }
.bar-mini i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 12px 14px; background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th:first-child { border-start-start-radius: 12px; } .t th:last-child { border-start-end-radius: 12px; }
.t td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr.click { cursor: pointer; transition: background .1s; }
.t tr.click:hover td { background: #FBFAF6; }
.t tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 500; font-size: 13.5px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line); }
.tabs .c { font: 600 11.5px var(--num); background: var(--soft); border-radius: 8px; padding: 1px 7px; }
.filters-row { display: flex; gap: 10px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filters-row input, .filters-row select { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--soft); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-size: 13px; color: var(--muted); }

.overlay { position: fixed; inset: 0; background: rgba(20,24,10,.35); z-index: 60; animation: fade .2s; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(560px, 100vw); background: var(--bg); z-index: 70; display: flex; flex-direction: column; animation: slide .28s cubic-bezier(.2,.8,.2,1); box-shadow: 20px 0 50px -20px rgba(0,0,0,.3); }
@keyframes slide { from { transform: translateX(-100%); } } @keyframes fade { from { opacity: 0; } }
.drawer-h { padding: 20px 24px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer-b { flex: 1; overflow: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer-f { padding: 16px 24px; background: var(--surface); border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.kv span { color: var(--muted); }
.hist { position: relative; padding-inline-start: 22px; }
.hist div { position: relative; padding-bottom: 14px; font-size: 13.5px; }
.hist div::before { content: ''; position: absolute; right: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 0 3px var(--bg); }
.hist div::after { content: ''; position: absolute; right: -18px; top: 18px; bottom: -4px; width: 2px; background: var(--line); }
.hist div:last-child::after { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select { height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface); }
.field input:focus, .field select:focus, .filters-row input:focus { outline: 2px solid rgba(62,74,34,.25); border-color: var(--accent); }
.switch { width: 40px; height: 24px; border-radius: 12px; background: #D6D3C4; position: relative; transition: .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--accent); } .switch.on::after { right: 19px; }
.stockbar { width: 90px; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; display: inline-block; vertical-align: middle; margin-inline-start: 8px; }
.stockbar i { display: block; height: 100%; border-radius: 3px; }
.alert { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: #FFF7ED; color: #9A3412; font-size: 13.5px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--deep); color: #F6F0E1; padding: 12px 18px; border-radius: 14px; z-index: 99; box-shadow: 0 16px 36px -12px rgba(0,0,0,.5); display: flex; gap: 10px; align-items: center; animation: up .25s; }
@keyframes up { from { transform: translate(-50%, 16px); opacity: 0; } }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1.1fr; }
.login .art { background: radial-gradient(circle at 30% 30%, #4d5a2b, var(--deep) 65%); color: #F6F0E1; padding: 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art::after { content: ''; position: absolute; inset: auto -120px -160px auto; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(246,240,225,.12); box-shadow: 0 0 0 60px rgba(246,240,225,.03), 0 0 0 140px rgba(246,240,225,.02); }
.login .form { display: grid; place-items: center; padding: 40px; }
.login form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login h1 { font: 700 30px/1.3 var(--f); margin: 0; }

/* invoice */
.invoice { max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 48px 54px; }
.invoice h2 { margin: 0; font: 700 26px var(--f); }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 24px; border-bottom: 2px solid var(--ink); }
.inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 26px 0; }
.inv-meta h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.label-ship { border: 2px dashed var(--ink); border-radius: 12px; padding: 18px 22px; margin-top: 28px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.barcode { height: 54px; width: 220px; background: repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 3px, #111 3px 6px, #fff 6px 8px, #111 8px 9px, #fff 9px 12px); }
@media print {
  body { background: #fff; }
  .shell { display: block; } aside.side, .top, .no-print, .demo-badge { display: none !important; }
  main.content { padding: 0; }
  .invoice { border: 0; padding: 0; max-width: none; }
}
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); } .login .form { padding: 28px 16px; }
  .shell { grid-template-columns: 1fr; }
  aside.side { position: fixed; inset: 0 0 0 auto; width: 270px; z-index: 80; transform: translateX(100%); transition: transform .25s; }
  aside.side.open { transform: none; }
  main.content { padding: 0 16px 40px; }
  .top { margin: 0 -16px 6px; padding: 0 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .login { grid-template-columns: 1fr; }
  .login .art { display: none; }
  .table-wrap { overflow-x: auto; }
  .hide-m { display: none; }
}
@media (min-width: 901px) { .menu-only { display: none !important; } }
