/* Senghor Resto — نفس هوية تطبيق الأمن: ألوان شعار Université Senghor على أسود */
:root {
  --c-green: #8bbb0c; --c-red: #e32129; --c-blue: #009ee0; --c-purple: #ab35c6; --c-yellow: #febb01;
  --bg: #f4f5f6; --surface: #ffffff; --surface-2: #eef0f2; --fg: #15181b; --muted: #5d656c; --line: #d9dde1;
  --ink: #15181b; --ink-fg: #ffffff; --accent: #007db3;
  --ok: #1f6b2c; --ok-bg: #e3f1e6; --warn: #8a5a00; --warn-bg: #fff2cc; --bad: #b3161c; --bad-bg: #fde6e6; --info: #006f9f;
  --font: "IBM Plex Sans", "IBM Plex Sans Arabic", "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  color-scheme: light;
}
:root[dir="rtl"] { --font: "IBM Plex Sans Arabic", "IBM Plex Sans", Tahoma, Arial, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; margin-bottom: 10px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .86rem; } .strong { font-weight: 600; } .center { text-align: center; }
.mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; } .nowrap { white-space: nowrap; } .big { font-size: 1.4rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-t { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid-t { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.ok-t { color: var(--ok); font-weight: 600; } .warn-t { color: var(--warn); font-weight: 600; } .bad-t { color: var(--bad); font-weight: 600; } .info-t { color: var(--info); font-weight: 600; } .muted-t { color: var(--muted); }
.err { color: var(--bad); margin: 0; min-height: 1em; }

/* forms */
label { display: grid; gap: 5px; font-size: .9rem; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid #c3c8cd; border-radius: 9px; padding: 9px 11px; min-height: 44px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { min-height: 0; width: 18px; height: 18px; accent-color: var(--ink); }
input[type=color] { padding: 2px; width: 56px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
legend { padding: 0 6px; font-weight: 600; font-size: .9rem; }
.chk { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); font-weight: 500; min-height: 34px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid #c3c8cd; background: var(--surface); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn.big { min-height: 52px; font-size: 1.05rem; }
.btn.huge { min-height: 76px; font-size: 1.45rem; border-radius: 16px; flex: 1; }
.btn.huge.narrow { flex: 0 0 160px; font-size: 1.1rem; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.row2 { display: flex; gap: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.notice { padding: 10px 14px; border-radius: 10px; font-weight: 500; }
.notice.warn { background: var(--warn-bg); color: var(--warn); } .notice.ok { background: var(--ok-bg); color: var(--ok); }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex: none; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); font-size: .86rem; font-weight: 600; white-space: nowrap; color: var(--fg); }

/* layout */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: var(--surface); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand > div { display: grid; line-height: 1.25; }
.brand strong { font-size: 1.1rem; }
.logo { height: 34px; width: auto; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.stripe { height: 4px; background: linear-gradient(90deg, var(--c-green) 0 20%, var(--c-red) 20% 40%, var(--c-blue) 40% 60%, var(--c-purple) 60% 80%, var(--c-yellow) 80%); }
.langs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.langs button { min-width: 42px; min-height: 36px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-weight: 700; cursor: pointer; color: var(--fg); }
.langs button.on { background: var(--ink); color: #fff; }
.tabs { display: flex; gap: 4px; padding: 8px 20px 0; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; padding: 12px 14px; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--ink); }
.view { max-width: 1280px; margin: 0 auto; padding: 20px; display: grid; gap: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; display: grid; gap: 2px; }
.stat span { font-size: .86rem; color: var(--muted); } .stat strong { font-size: 1.6rem; font-family: var(--mono); font-weight: 600; } .stat em { font-style: normal; font-size: .82rem; }
.stat.bad strong { color: var(--bad); }
.tablewrap { overflow-x: auto; } .tablewrap.tall { max-height: 52vh; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: .82rem; color: var(--muted); font-weight: 600; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid #eceef0; vertical-align: middle; }
.tbl.small td { padding: 6px 8px; font-size: .9rem; }
.tbl tr.off td { opacity: .5; }
.tbl .totrow td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.tbl tr.st-new td:first-child { box-shadow: inset 4px 0 0 var(--ok); } .tbl tr.st-changed td:first-child { box-shadow: inset 4px 0 0 var(--warn); } .tbl tr.st-error td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; } .filters input { flex: 1 1 260px; }
.bulk { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); border-radius: 10px; }
.pcell { display: flex; align-items: center; gap: 10px; }
.pcell img, .pcell .ph, img.mini { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.ph { display: inline-flex; align-items: center; justify-content: center; background: #d9dee4; color: #1b3a5c; font-weight: 700; }
.ph.big { width: 130px; height: 160px; border-radius: 12px; font-size: 2.4rem; }
.pedit { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; }
@media (max-width: 640px) { .pedit { grid-template-columns: 1fr; } }
.photo-pick { display: grid; gap: 8px; justify-items: center; align-content: start; }
.photo-pick img { width: 130px; height: 160px; object-fit: cover; border-radius: 12px; }
.drop { display: grid; place-items: center; gap: 8px; padding: 26px; border: 2px dashed #b9bfc5; border-radius: 12px; color: var(--fg); font-weight: 600; cursor: pointer; text-align: center; }
.slots { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; } .slots fieldset { flex-wrap: nowrap; }
.progs { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; } .prog { display: flex; align-items: center; gap: 8px; color: var(--fg); font-weight: 700; }
.seg { display: flex; gap: 6px; } .seg label { flex: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg); font-weight: 600; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 6px; }
.bar { flex: 1; max-width: 38px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 10px; }
.bar span { display: block; width: 100%; background: var(--ink); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar em { font-style: normal; font-size: .7rem; color: var(--muted); font-family: var(--mono); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #15181b, #2a3138); }
.login { width: min(420px, 100%); display: grid; gap: 12px; }
.login-head { display: flex; justify-content: space-between; align-items: center; }
.login h1 { font-size: 1.6rem; }

/* dialog / toast */
dialog { border: 0; border-radius: 16px; padding: 22px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.wide { width: min(980px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10,12,14,.5); }
.toast { position: fixed; inset-inline: 0; bottom: 22px; margin: auto; width: fit-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; z-index: 50; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }

/* ---------- الكاشير ---------- */
.subtabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.subtabs button { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; cursor: pointer; }
.subtabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.slot-pill { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); }
.slot-pill.closed { color: var(--muted); }
.cash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
@media (max-width: 900px) { .cash { grid-template-columns: minmax(0, 1fr); } .cash-main { min-height: 0; padding: 14px; } .banner .q { font-size: 1.2rem; } .btn.huge { min-height: 64px; font-size: 1.15rem; } .btn.huge.narrow { flex-basis: 110px; } }
@media (max-width: 560px) { .view { padding: 12px; } .top { padding: 8px 12px; } .tabs { padding: 4px 12px 0; } .banner { padding: 10px 12px; gap: 10px; } .banner .ic { width: 48px; height: 48px; padding: 9px; } .cash-done h2, .cash-idle h2 { font-size: 1.4rem; } .bigcount strong { font-size: 2.6rem; } }
.cash-main { display: flex; flex-direction: column; gap: 16px; min-height: 620px; padding: 22px; }
.cash-state { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.cash-idle { flex: 1; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; }
.cash-idle .ring { width: 120px; height: 120px; border-radius: 50%; background: #e8f0f7; color: #1b3a5c; display: grid; place-items: center; }
.cash-idle h2 { font-size: 2rem; }
.banner { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 16px; }
.banner .ic { flex: none; width: 64px; height: 64px; padding: 12px; border-radius: 50%; color: #fff; }
.banner.ok { background: var(--ok-bg); color: var(--ok); } .banner.ok .ic { background: var(--ok); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border: 2px solid var(--bad); } .banner.bad .ic { background: var(--bad); }
.banner .q { font-size: 1.55rem; font-weight: 700; color: var(--fg); line-height: 1.3; }
.banner.bad .q { color: var(--bad); }
.cardcopy { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; }
.cardcopy > *, .sheet > * { max-width: 100%; }
.cash-done { flex: 1; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; background: var(--ok-bg); color: var(--ok); border-radius: 16px; padding: 20px; }
.cash-done .ic { width: 130px; height: 130px; padding: 24px; border-radius: 50%; background: var(--ok); color: #fff; }
.cash-done h2 { font-size: 2rem; color: var(--fg); }
.scanform { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px dashed #c3c8cd; padding-top: 14px; }
.scanform input { flex: 1 1 260px; font-family: var(--mono); font-size: 1.1rem; }
.scanform input::placeholder { font-family: var(--font); letter-spacing: 0; }
.camv { width: 100%; max-height: 260px; border-radius: 12px; background: #000; object-fit: cover; }
.cash-side { display: grid; gap: 12px; align-content: start; }
.bigcount { background: var(--ink); color: #fff; border-radius: 16px; padding: 16px 18px; display: grid; }
.bigcount span { color: #c9ced6; font-size: .92rem; } .bigcount strong { font-family: var(--mono); font-size: 3.6rem; line-height: 1.1; font-weight: 600; }
.kindcounts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; }
.kc span { font-size: .82rem; color: var(--muted); } .kc strong { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; }
.recent { padding: 14px; } .rec { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #eceef0; font-size: .9rem; }
.rec .dot { width: 10px; height: 10px; border-radius: 50%; } .rec .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report { display: grid; gap: 16px; } .report-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: end; }

/* نسخة كارت الطالب (نفس تصميم الكارت الحقيقي) */
.idcard { --prog: #F1C232; position: relative; width: 560px; max-width: 100%; aspect-ratio: 1.6; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line); font-family: Montserrat, sans-serif; color: #111; container-type: inline-size; }
.id-left { position: absolute; inset: 0 37.7% 16.8% 0; background: var(--prog); padding: 4.5cqw 4cqw; display: flex; flex-direction: column; color: #fff; }
.id-top { text-align: center; } .id-hash { font-size: 3.1cqw; letter-spacing: .35cqw; font-weight: 500; } .id-tag { font-size: 1.55cqw; line-height: 1.4; }
.id-name { margin-top: 7cqw; font-size: 3.9cqw; line-height: 1.15; } .id-role, .id-code { font-size: 2.1cqw; font-weight: 700; color: #111; } .id-role { margin-top: 2cqw; }
.id-mail { position: absolute; right: 1.4cqw; top: 8cqw; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 1.45cqw; font-weight: 700; color: #111; }
.id-photo { position: absolute; inset: 0 0 16.8% 62.3%; background: #d9dee4; }
.idimg { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; font-size: 10cqw; }
.id-bottom { position: absolute; inset: auto 0 0 0; height: 21%; display: flex; align-items: flex-end; gap: 2.5cqw; padding: 0 3cqw 2.2cqw; }
.id-years { background: #D678C7; color: #fff; display: grid; text-align: center; font-size: 2.4cqw; line-height: 1.15; padding: .8cqw 1.4cqw; }
.id-bar { width: 40cqw; background: #fff; text-align: center; font-family: var(--mono); font-size: 1.7cqw; } .id-bar .barcode { width: 100%; height: 7cqw; display: block; }
.id-campus { margin-inline-start: auto; font-size: 3cqw; font-weight: 500; }

/* كارت موظف */
.staffcard { width: 560px; max-width: 100%; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.sc-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: #1b3a5c; color: #fff; font-family: Montserrat, sans-serif; font-weight: 700; }
.sc-body { display: flex; gap: 20px; padding: 18px 20px; } .sc-body .photo { width: 130px; height: 160px; border-radius: 10px; object-fit: cover; flex: none; font-size: 2.4rem; }
.sc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; } .sc-name { font-size: 1.5rem; font-weight: 700; color: #111; }
.sc-bar { margin-top: auto; text-align: center; } .sc-bar .barcode { width: 100%; height: 44px; display: block; }

/* تيكت الوجبة (نفس تصميم تيكتات المطعم) */
.stub { display: flex; width: 560px; max-width: 100%; min-height: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: #2b2b2b; break-inside: avoid; }
.st-left { width: 32%; padding: 16px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; }
.st-ticket { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 2.6rem; line-height: 1; } .st-year { font-size: .82rem; color: #15181b; }
.st-right { flex: 1; min-width: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.st-meal { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 3rem; line-height: 1; }
.st-name { font-weight: 700; font-size: 1.05rem; } .st-valid { font-size: .78rem; color: #4a525c; }
.st-foot { margin-top: auto; display: flex; align-items: flex-end; gap: 12px; }
.st-bar { flex: 1; min-width: 0; text-align: center; font-size: .78rem; } .st-bar .barcode { width: 100%; height: 34px; display: block; }
.st-logo { display: flex; align-items: center; gap: 4px; line-height: 1.05; } .st-logo span { font-size: .5rem; font-weight: 700; text-align: right; } .st-logo b { font-size: .95rem; }
.sheet { display: grid; gap: 12px; justify-items: center; }
#printarea { display: none; }

/* طباعة */
@media print {
  body { background: #fff; }
  .top, .stripe, .tabs, .subtabs, .actions, .scanform, .noprint, #toast { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .view { padding: 0; }
  body.printing-tickets > *:not(#printarea) { display: none !important; }
  body.printing-tickets #printarea { display: block; }
  body.printing-tickets .sheet { display: block; }
  body.printing-tickets .stub { width: 180mm; min-height: 80mm; margin: 0 auto; border: 0; border-bottom: 1px dashed #888; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  dialog { display: none; }
}
