/* هوية القاهرة اليوم: حبر الليل، ذهب الشعار، طين، على ورق كريمي — بخط Tajawal.
   ملف واحد لكل الشاشات: عدّل المتغيرات أدناه ليتغير النظام كله. */
@font-face { font-family: 'Tajawal'; src: url('/fonts/Tajawal-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Tajawal'; src: url('/fonts/Tajawal-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Tajawal'; src: url('/fonts/Tajawal-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Tajawal'; src: url('/fonts/Tajawal-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }

:root {
  --ink: #202E38;        /* حبر — الترويسات والجداول (تباين 12.6 على الورق) */
  --espresso: #202E38;
  --brass: #C4A674;      /* ذهب — الخطوط والتمييز */
  --brass-soft: #E8D9BD;
  --sand: #F7F3E9;       /* ورق */
  --paper: #FFFDF8;
  --line: #D9D3C7;
  --green: #1E6F52;      /* نجاح */
  --clay: #873E2C;       /* طين — تنبيه وخطأ (تباين 6.9) */
  --muted: #6D6F68;      /* نص ثانوي (تباين 4.6) */
  --r: 4px;
  --shadow: 0 1px 2px rgba(32,46,56,.06), 0 8px 22px -18px rgba(32,46,56,.45);
  --display: 'Tajawal', Tahoma, sans-serif;
  --body: 'Tajawal', Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sand); color: var(--ink);
  font: 400 15px/1.6 var(--body); font-feature-settings: 'tnum' 1; }
h1, h2, h3, .display { font-family: var(--display); font-weight: 700; }
th { font-weight: 700; }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.25rem; margin: 0 0 .4rem; }
h3 { font-size: 1.05rem; margin: 0 0 .6rem; color: var(--espresso); }
a { color: var(--espresso); text-underline-offset: 3px; }
.muted { color: var(--muted); font-size: .86rem; }

/* شريط التنقل */
nav { display: flex; gap: 4px; align-items: center; background: var(--ink); padding: 10px 12px;
  border-bottom: 3px solid var(--brass); overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav b { font-family: var(--display); color: var(--paper); font-size: 1.05rem; margin-left: 14px; white-space: nowrap; }
nav a { color: var(--brass-soft); text-decoration: none; padding: 11px 14px; border-radius: var(--r); white-space: nowrap; font-size: .93rem; }
nav a:hover { background: rgba(233,212,176,.12); color: #fff; }
nav a.on { background: var(--brass); color: var(--ink); font-weight: 700; }

main { padding: 14px; max-width: 1200px; margin: 0 auto; }

/* بطاقات */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card .card { box-shadow: none; background: #FCFAF6; }

/* أزرار */
button { font: 700 .95rem var(--body); border: 0; border-radius: var(--r); padding: 9px 16px; min-height: 44px; touch-action: manipulation;
  background: var(--espresso); color: var(--paper); cursor: pointer; transition: filter .12s; }
button:hover { filter: brightness(1.12); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
button.ok { background: var(--green); } button.no { background: var(--clay); }
button.lite { background: var(--sand); color: var(--espresso); border: 1px solid var(--line); }
button[disabled] { opacity: .55; cursor: wait; }

/* حقول */
input, select { font: inherit; padding: 8px 10px; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--paper); color: var(--ink); width: 100%; }
input::placeholder { color: #A99884; }

/* جداول */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--espresso); color: var(--paper); text-align: right; padding: 9px 8px; font-size: .85rem; font-weight: 700; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td, tr:last-child td { border-bottom: 0; }
tr.low td { background: #FBEDE9; }
td input, td select { padding: 6px 8px; font-size: .9rem; min-height: 40px; }

/* شبكة أزرار المنيو */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 7px; }
.grid button { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-bottom: 3px solid var(--brass-soft);
  padding: 12px 8px; min-height: 68px; font-weight: 700; }
.grid button small { display: block; color: var(--muted); font-weight: 400; margin-top: 3px; }

.cols { display: grid; grid-template-columns: 2fr 1.1fr 1.4fr; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row > * { flex: 1; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

/* بطاقات المؤشرات */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.kpi { background: var(--sand); border: 1px solid var(--line); border-top: 3px solid var(--brass); border-radius: 8px; padding: 10px 12px; font-size: .84rem; color: var(--muted); }
.kpi b { display: block; font: 700 1.35rem/1.2 var(--display); color: var(--espresso); margin-bottom: 2px; }

/* تذاكر شاشات الأقسام */
.kds { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tk { background: var(--paper); border: 1px solid var(--line); border-top: 5px solid var(--green); border-radius: var(--r);
  padding: 13px; box-shadow: var(--shadow); font-size: 1.05rem; }
.tk.late { border-top-color: var(--clay); background: #FDF6F4; }
.tk button { width: 100%; margin-top: 8px; }

/* إشعار */
#msg { position: fixed; bottom: 16px; left: 16px; background: var(--ink); color: var(--brass-soft);
  padding: 11px 16px; border-radius: 8px; display: none; box-shadow: var(--shadow); z-index: 9; }

/* صفحات الزبائن */
.public header { background: var(--ink); color: var(--sand); padding: 18px 16px 16px; text-align: center; border-bottom: 1px solid var(--brass); }
.public header img { height: 64px; display: block; margin: 0 auto 4px; }
.public header h1 { font-size: 1.35rem; }
.public header .sub { color: var(--brass-soft); font-size: .92rem; margin-top: 3px; }
.public main { max-width: 620px; }
.public h2 { font-size: 1rem; color: var(--espresso); margin: 20px 0 8px; display: flex; align-items: center; gap: 10px; }
.public h2::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.item { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; margin-bottom: 6px; }
.item .price { font-weight: 700; color: var(--clay); white-space: nowrap; }
.hero { height: 170px; background: var(--ink) center 35%/cover no-repeat; } /* واجهة الكافيه ولافتته — بلا وجوه */
.chips { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px; background: var(--sand);
  border-bottom: 1px solid var(--line); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; padding: 9px 14px; min-height: 40px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper);
  color: var(--ink); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.chips a:active, .chips a:focus-visible { background: var(--clay); color: var(--sand); border-color: var(--clay); }
.public section { scroll-margin-top: 64px; }
.pub-foot { background: var(--ink); color: var(--brass-soft); text-align: center; padding: 22px 16px 26px; margin-top: 22px; font-size: .9rem; }
.pub-foot a { color: var(--sand); }
.pub-foot .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 12px 0; }
.pub-foot .links a { padding: 8px 2px; }
.search { margin: 12px 0 4px; }
label { display: block; margin: 12px 0 4px; font-size: .88rem; color: var(--muted); }
/* المحاسبة والتقرير الشهري */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 10px; }
.grid2 label, .grid4 label { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.btnlink { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--sand); color: var(--ink); text-decoration: none; font-weight: 700; margin-inline-start: 6px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 99px; font-weight: 700; font-size: .85rem; background: var(--sand); border: 1px solid var(--line); }
.badge.ok { background: #E6F2EC; color: var(--green); border-color: #B9DCC9; } .badge.no { background: #FBEDE9; color: var(--clay); border-color: #E9C2B8; }
tr.sum td { background: var(--sand); font-weight: 700; }
ul.missing { margin: 4px 0 0; padding-inline-start: 20px; } ul.missing li { margin: 2px 0; }
.signs p { margin: 14px 0; }
@media print { .report .kpis { grid-template-columns: repeat(4, 1fr); } .report .card { break-inside: avoid; } }

.printonly { display: none; }
@media print { .printonly { display: table-cell; } }

/* لوحة الطاولات */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; flex: none; }
.seg button { background: var(--paper); color: var(--ink); border-radius: 0; font-weight: 400; }
.seg button.on { background: var(--ink); color: var(--sand); font-weight: 700; }
h3.zone { margin: 16px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tcell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 84px; padding: 8px 10px; text-align: right;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-top: 4px solid var(--line); font-weight: 400; }
.tcell b { font: 700 1.25rem/1.1 var(--body); }
.tcell .st { font-size: .82rem; font-weight: 700; }
.tcell small { font-size: .78rem; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.tcell.free { border-top-color: var(--line); } .tcell.free .st { color: var(--muted); font-weight: 400; }
.tcell.reserved { border-top-color: var(--brass); background: #FBF6EC; } .tcell.reserved .st { color: #6E5429; }
.tcell.waiting { border-top-color: var(--ink); } .tcell.served { border-top-color: var(--green); } .tcell.served .st { color: var(--green); }
.tcell.late { border-top-color: var(--clay); background: #FBEDE9; } .tcell.late .st { color: var(--clay); }
.sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 8; max-height: 70vh; overflow: auto; background: var(--paper);
  border-top: 3px solid var(--brass); box-shadow: 0 -10px 30px -12px rgba(32,46,56,.45); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.tcard .tzone { font-size: .78rem; color: var(--muted); margin: -6px 0 6px; }

/* لوحة الصلاحيات */
fieldset.perms { border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 10px; padding: 8px 12px 10px; }
fieldset.perms legend { font-weight: 700; color: var(--ink); padding: 0 6px; }
fieldset.perms label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0 0 0 18px; color: var(--ink); font-size: .95rem; }
fieldset.perms input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--green); }

/* بطاقات الطاولات للطباعة */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tcard { background: var(--paper); border: 1.5px solid var(--espresso); border-top: 6px solid var(--brass); border-radius: 10px;
  padding: 12px; text-align: center; break-inside: avoid; }
.tcard .brand { font: 700 .95rem var(--display); color: var(--brass); letter-spacing: .03em; }
.tcard .tno { font: 800 1.7rem/1.2 var(--display); color: var(--ink); margin: 2px 0 8px; }
.tcard .code svg { width: 150px; height: 150px; display: block; margin: 0 auto; }
.tcard .code.small svg { width: 70px; height: 70px; }
.tcard .cap { font-size: .82rem; color: var(--espresso); margin-top: 6px; line-height: 1.45; }
.tcard .rev { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.tcard .rev .cap { margin: 0; text-align: right; }
@page { size: A4; margin: 10mm; }
@media print {
  .cards { grid-template-columns: repeat(3, 1fr); gap: 5mm; }
  .tcard { height: 88mm; overflow: hidden; } .tcard:nth-child(9n) { break-after: page; }
  .tcard .code svg { width: 42mm; height: 42mm; } .tcard .code.small svg { width: 18mm; height: 18mm; }
  .tcard { -webkit-print-color-adjust: exact; print-color-adjust: exact; } nav, button, input, .noprint { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
