:root {
  --bg: #f6f5f3;
  --card: #ffffff;
  --text: #221f1f;
  --muted: #6b6664;
  --line: #e4e1dd;
  --brand: #221f1f;
  --brand-text: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e5f4ec;
  --warn: #9a5b00;
  --warn-bg: #fdf1dc;
  --danger: #b3261e;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121111;
    --card: #1c1b1b;
    --text: #f2f0ee;
    --muted: #a9a4a1;
    --line: #33302f;
    --brand: #f2f0ee;
    --brand-text: #121111;
    --ok: #6fd3a0;
    --ok-bg: #173327;
    --warn: #f0b760;
    --warn-bg: #3a2a12;
    --danger: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap.wide { max-width: 900px; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
header.top h1 { font-size: 22px; margin: 0; line-height: 1.2; }
/* Logo drawn as a mask so it takes the text colour in both light and dark mode. */
.logo {
  display: block; aspect-ratio: 105.27 / 75.49; background: var(--text);
  -webkit-mask: url(/logo.svg) center / contain no-repeat; mask: url(/logo.svg) center / contain no-repeat;
}
header.brand { position: relative; display: flex; justify-content: center; padding: 8px 0 24px; }
header.brand .logo { width: 132px; }
header.brand .lang { position: absolute; top: 0; inset-inline-end: 0; }
header.top .logo { width: 64px; flex: none; }
header.top .title { display: flex; align-items: center; gap: 14px; }
/* Customer page: the welcome picture on top, a blurred copy of it filling the screen behind. */
body.photo { background: #1d1612; }
body.photo::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.45)), url(/welcome-blur.jpg) center / cover;
}
header.hero { position: relative; margin-bottom: 16px; }
header.hero img {
  display: block; width: 100%; height: auto; aspect-ratio: 2 / 1;
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
header.hero .lang {
  position: absolute; top: 10px; inset-inline-end: 10px;
  background: rgba(0,0,0,.45); border-color: rgba(255,255,255,.35); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
body.photo .btn.ghost { background: var(--card); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lang { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

label { display: block; font-weight: 600; font-size: 15px; margin: 14px 0 6px; }
label:first-child { margin-top: 0; }
input {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type="tel"] { direction: ltr; }
[dir="rtl"] input[type="tel"] { text-align: right; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 48px; height: 48px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 24px; cursor: pointer; }
.stepper output { flex: 1; text-align: center; font-size: 22px; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; border-radius: 10px; padding: 12px 18px; cursor: pointer;
  border: 1px solid transparent; background: var(--brand); color: var(--brand-text); text-decoration: none;
}
.btn.block { width: 100%; margin-top: 20px; padding: 14px; font-size: 18px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sm { padding: 8px 12px; font-size: 15px; }

.error { color: var(--danger); font-size: 15px; margin-top: 12px; min-height: 1em; }

/* ticket */
.ticket-no { font-size: 84px; font-weight: 800; line-height: 1; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.ahead { font-size: 20px; margin: 18px 0 4px; }
.ahead strong { font-size: 40px; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.banner { border-radius: var(--radius); padding: 18px; font-weight: 700; font-size: 20px; text-align: center; margin-bottom: 14px; }
.banner.ok { background: var(--ok-bg); color: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.banner.info { background: var(--warn-bg); color: var(--warn); }
@keyframes pulse { 50% { transform: scale(1.02); } }
@media (prefers-reduced-motion: reduce) { .banner.ok { animation: none; } }

/* staff */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; }
.row + .row { margin-top: 10px; }
.row.called { border-color: var(--ok); box-shadow: inset 4px 0 0 var(--ok); }
[dir="rtl"] .row.called { box-shadow: inset -4px 0 0 var(--ok); }
.row .no { grid-row: span 2; font-size: 30px; font-weight: 800; min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.row .who { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.row .meta { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.row .meta a { color: inherit; direction: ltr; unicode-bidi: embed; }
.row .actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.switch { display: inline-flex; align-items: center; gap: 8px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); width: min(420px, calc(100% - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.4); }

/* staff + owner */
.narrow { max-width: 360px; margin: 0 auto; }
.pin-input { font-size: 28px; letter-spacing: .5em; text-align: center; direction: ltr; font-variant-numeric: tabular-nums; }
[dir="rtl"] .pin-input { text-align: center; }
.who-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs button { font: inherit; font-size: 15px; font-weight: 600; border: 0; background: none; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-text); }
.card-title { font-size: 18px; margin: 0 0 12px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.list-gap { margin-top: 14px; }
.staff-row { grid-template-columns: 1fr auto; }
.dlg-actions { display: flex; gap: 10px; margin-top: 16px; }
.toolbar .switch { margin: 0; }
.toolbar .switch input { width: auto; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 560px) { .stats.four { grid-template-columns: repeat(2, 1fr); } }
.table-card { padding: 0; overflow-x: auto; }
.history { width: 100%; border-collapse: collapse; font-size: 15px; }
.history th, .history td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.history th { font-size: 13px; color: var(--muted); font-weight: 600; }
.history tr:last-child td { border-bottom: 0; }
.table-card > p { padding: 16px; margin: 0; }
a.logo { text-decoration: none; }

/* customer page footer */
.staff-link { display: block; text-align: center; margin-top: 28px; font-size: 14px; color: rgba(255,255,255,.75); text-decoration: none; }
.staff-link:hover { color: #fff; text-decoration: underline; }
.small { font-size: 14px; }
.link-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.linkish { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 14px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--text); }

/* owner history */
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { font: inherit; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .range { grid-template-columns: 1fr; } }
.range label { margin-top: 0; }
.range-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.stats.six { grid-template-columns: repeat(3, 1fr); }
.stat b { overflow-wrap: anywhere; }
#hResults > * + * { margin-top: 14px; }
#hResults .card + .card { margin-top: 14px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 48px 1fr 32px; align-items: center; gap: 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
.bar-label { color: var(--muted); direction: ltr; }
.bar-track { height: 14px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--brand); border-radius: 4px; min-width: 2px; }
.bar-value { text-align: end; }
td.ltr { direction: ltr; text-align: start; }
td.ltr a { color: inherit; }
.pill.off { background: var(--bg); color: var(--muted); }
.actions-inline { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.field-note { margin: 6px 0 0; }
