/* مطبخ حياكم — هوية دافئة: عنّابي ترابي + زعفراني + كريمي */
:root {
  --brand: #7A2614; --brand-2: #9A3A1E; --brand-dk: #4E170A;
  --saffron: #F2A93B; --saffron-2: #E0921F;
  --ink: #2B1A12; --muted: #85705F; --bg: #FBF6EF; --card: #fff; --line: #EFE3D3;
  --ok: #2E9E5B; --bad: #D2352B;
  --radius: 16px; --shadow: 0 6px 22px rgba(122, 38, 20, .07);
  --bs-primary: #9A3A1E; --bs-primary-rgb: 154, 58, 30;
}
* { -webkit-tap-highlight-color: transparent; }
html, body { font-family: 'Tajawal', system-ui, sans-serif; background: var(--bg); color: var(--ink); }
body.app { display: flex; min-height: 100vh; }
a { color: var(--brand-2); }
.money, .num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; font-weight: 700; }
.cur { color: var(--muted); font-size: .75em; }

/* الشريط الجانبي */
.sidebar { width: 255px; flex-shrink: 0; background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dk) 100%); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1040; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 18px; text-decoration: none; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar .brand img { width: 46px; height: 46px; }
.sidebar .brand b { display: block; font-size: 1.15rem; font-weight: 900; color: var(--saffron); }
.sidebar .brand small { color: rgba(255,255,255,.65); font-size: .75rem; }
.sidebar nav { padding: 8px 10px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 9px 14px; margin: 2px 0; border-radius: 12px; color: rgba(255,255,255,.85); text-decoration: none; font-weight: 500; transition: .15s; }
.sidebar nav a i { font-size: 1.15rem; width: 22px; text-align: center; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: var(--saffron); color: var(--brand-dk); font-weight: 800; box-shadow: 0 4px 14px rgba(242,169,59,.35); }
.nav-sec { font-size: .72rem; color: rgba(255,255,255,.45); padding: 12px 14px 3px; font-weight: 700; }
.side-foot { padding: 12px 16px 18px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 6px; }
.side-foot a { color: rgba(255,255,255,.88); text-decoration: none; font-size: .9rem; }
.side-foot small { color: rgba(255,255,255,.5); }
.side-backdrop { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: #fff; border-bottom: 3px solid var(--saffron); position: sticky; top: 0; z-index: 1020; }
.topbar h1 { font-size: 1.3rem; font-weight: 900; margin: 0; color: var(--brand); }
.content { padding: 22px 24px 40px; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; right: -280px; transition: right .25s; }
  body.side-open .sidebar { right: 0; }
  body.side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1030; }
  .content { padding: 14px 12px 40px; } .topbar { padding: 10px 14px; } .topbar h1 { font-size: 1.1rem; }
}

/* عناصر */
.btn { border-radius: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-saffron { background: var(--saffron); color: var(--brand-dk); border: none; }
.btn-saffron:hover, .btn-saffron:focus { background: var(--saffron-2); color: var(--brand-dk); }
.btn-brand { background: var(--brand); color: #fff; border: none; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-2); color: #fff; }
.btn-primary { background: var(--brand-2); border-color: var(--brand-2); }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-outline-primary { color: var(--brand-2); border-color: var(--brand-2); }
.btn-outline-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-wa { background: #25D366; color: #fff; border: none; } .btn-wa:hover { background: #1DA851; color: #fff; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 12px; background: var(--bg); color: var(--brand); font-size: 1.25rem; border: none; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 800; color: var(--brand); padding: 13px 18px; display: flex; align-items: center; gap: 8px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid var(--line); position: relative; height: 100%; }
.kpi .lbl { color: var(--muted); font-size: .88rem; font-weight: 600; padding-left: 48px; }
.kpi .val { font-size: 1.55rem; font-weight: 900; color: var(--brand); margin-top: 4px; line-height: 1.2; }
.kpi .val small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi .sub { font-size: .8rem; margin-top: 4px; color: var(--muted); }
.kpi .ico { position: absolute; left: 14px; top: 14px; width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: #FBEEDC; color: var(--brand-2); }
.kpi.hot { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); border: none; }
.kpi.hot .lbl, .kpi.hot .val small, .kpi.hot .sub { color: rgba(255,255,255,.75); }
.kpi.hot .val { color: #fff; } .kpi.hot .ico { background: rgba(242,169,59,.2); color: var(--saffron); }
.kpi.gold { background: linear-gradient(135deg, var(--saffron) 0%, #F7C66E 100%); border: none; }
.kpi.gold .ico { background: rgba(122,38,20,.12); color: var(--brand); }
.kpi.gold .lbl { color: rgba(78,23,10,.75); }
@media (max-width: 575.98px) { .kpi { padding: 12px; } .kpi .ico { display: none; } .kpi .lbl { padding-left: 0; font-size: .8rem; } .kpi .val { font-size: 1.2rem; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 10px; text-align: center; text-decoration: none; color: var(--brand); font-weight: 800; box-shadow: var(--shadow); transition: .15s; }
.tile i { display: block; font-size: 2.2rem; color: var(--saffron-2); margin-bottom: 6px; }
.tile:hover { transform: translateY(-3px); border-color: var(--saffron); color: var(--brand); }

.table { --bs-table-bg: transparent; margin: 0; }
.table thead th { background: #FBF3E8; color: var(--muted); font-weight: 700; font-size: .85rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.form-control, .form-select { border-radius: 12px; border-color: #E6D6C1; padding: .5rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--saffron-2); box-shadow: 0 0 0 .2rem rgba(242,169,59,.2); }
.form-label { font-weight: 700; font-size: .88rem; color: var(--brand); margin-bottom: 4px; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state i { font-size: 3rem; color: #E3CFB6; display: block; margin-bottom: 8px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 16px; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700; background: #FBEEDC; color: var(--brand); }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-tabs a { padding: 7px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .9rem; }
.pill-tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill-tabs a .badge { margin-right: 4px; }

/* الدخول */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #B4532C 0, transparent 45%), linear-gradient(160deg, var(--brand), var(--brand-dk)); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 24px; padding: 32px 28px; box-shadow: 0 30px 70px rgba(0,0,0,.35); border-top: 6px solid var(--saffron); }
.login-card img { width: 84px; display: block; margin: 0 auto 10px; }
.login-card h2 { text-align: center; color: var(--brand); font-weight: 900; margin: 0; }
.login-card p.sub { text-align: center; color: var(--muted); margin-bottom: 22px; }

/* البيع المباشر */
.pos-wrap { display: flex; gap: 16px; align-items: flex-start; }
.pos-menu { flex: 1; min-width: 0; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.cats button { flex-shrink: 0; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 16px; font-weight: 800; color: var(--brand); }
.cats button.active { background: var(--brand); color: var(--saffron); border-color: var(--brand); }
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.icard { background: #fff; border-radius: 16px; border: 2px solid var(--line); padding: 14px 10px; cursor: pointer; text-align: center; user-select: none; transition: transform .08s; box-shadow: var(--shadow); }
.icard:hover { border-color: var(--saffron); }
.icard:active { transform: scale(.96); }
.icard .em { font-size: 2.3rem; line-height: 1.1; }
.icard .nm { font-weight: 800; color: var(--brand); margin-top: 6px; line-height: 1.3; }
.icard .pr { font-weight: 900; color: var(--saffron-2); margin-top: 4px; }
.icard .u { font-size: .75rem; color: var(--muted); }
.pos-cart { width: 380px; flex-shrink: 0; position: sticky; top: 76px; }
.citem { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-bottom: 1px dashed var(--line); }
.citem .nm { flex: 1; font-weight: 800; color: var(--brand); min-width: 0; }
.citem .nm small { display: block; color: var(--muted); font-weight: 500; }
.qtybox { display: flex; align-items: center; gap: 3px; }
.qtybox button { width: 32px; height: 32px; border-radius: 9px; border: none; background: #FBEEDC; color: var(--brand); font-weight: 900; font-size: 1.1rem; }
.qtybox .q { min-width: 36px; text-align: center; font-weight: 900; cursor: pointer; }
.cart-total { font-size: 1.9rem; font-weight: 900; color: var(--brand); }
@media (max-width: 991.98px) { .pos-wrap { flex-direction: column; align-items: stretch; } .igrid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); } .pos-cart { width: 100%; position: static; } }

/* المطبخ */
.kboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.kcard { background: #fff; border-radius: 18px; border: 2px solid var(--line); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.kcard .kh { padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; background: #FBF3E8; font-weight: 900; color: var(--brand); }
.kcard.late { border-color: var(--bad); } .kcard.late .kh { background: #FDE6E3; }
.kcard.soon { border-color: var(--saffron); }
.kcard ul { list-style: none; margin: 0; padding: 10px 14px; flex: 1; }
.kcard li { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 1.05rem; }
.kcard li b { color: var(--brand-2); font-size: 1.15rem; margin-left: 6px; }
.kcard .kf { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; }

/* التقويم */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dh { text-align: center; font-weight: 800; color: var(--muted); font-size: .85rem; }
.cal .d { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 96px; padding: 6px; font-size: .8rem; }
.cal .d.out { opacity: .35; } .cal .d.today { border: 2px solid var(--saffron); }
.cal .d .n { font-weight: 900; color: var(--brand); }
.cal .ev { display: block; background: #FBEEDC; border-radius: 6px; padding: 2px 5px; margin-top: 3px; text-decoration: none; color: var(--brand-dk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.st-cancelled { text-decoration: line-through; opacity: .5; }
.cal .ev.st-delivered { background: #DFF3E7; }
@media (max-width: 767.98px) { .cal { gap: 3px; } .cal .d { min-height: 64px; font-size: .68rem; padding: 3px; } .cal .d a.text-muted { display: none; } .cal .ev { padding: 1px 2px; } }

/* سطور الطلب */
.lines td { padding: 6px 4px; } .lines .form-control, .lines .form-select { padding: .4rem .55rem; }
.sum-box { background: #FBF3E8; border-radius: 14px; padding: 12px 16px; }
.sum-box .r { display: flex; justify-content: space-between; padding: 3px 0; }
.sum-box .r.t { font-size: 1.35rem; font-weight: 900; color: var(--brand); border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }

@media print { .sidebar, .topbar, .no-print { display: none !important; } .content { padding: 0; } body { background: #fff; } .card { box-shadow: none; } }

/* المرفقات */
.upl { display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px dashed #E6D6C1; border-radius: 14px; padding: 14px; cursor: pointer; color: var(--brand-2); font-weight: 700; background: #FFFBF5; text-align: center; }
.upl:hover { border-color: var(--saffron); background: #FBF3E8; }
.upl i { font-size: 1.5rem; }
.upl input { display: none; }
.att { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 8px; background: #FBEEDC; color: var(--brand); margin-left: 3px; text-decoration: none; }
.att:hover { background: var(--saffron); }
.att-item { display: flex; align-items: center; gap: 10px; background: #FBF3E8; border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; font-size: .85rem; max-width: 100%; }
.att-item a { text-decoration: none; font-weight: 700; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
