* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #047857;
  --green-dark: #065f46;
  --on-brand: #fff;   /* text colour on a --green fill; a pale venue brand switches this to dark ink */
  --ink: #1C1917;
  --muted: #78716C;
  --bg: #FAFAF8;
  --card: #ffffff;
  --line: #E7E5E4;
  --amber: #d97706;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  background-image: linear-gradient(#1C191705 1px, transparent 1px), linear-gradient(90deg, #1C191705 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.7;
}
h1, h2, h3, .topbar { font-family: 'Alexandria', 'IBM Plex Sans Arabic', sans-serif; }
.wrap { max-width: 520px; margin: 0 auto; padding: 18px 16px 60px; }
.topbar {
  background: var(--bg);
  color: var(--ink);
  padding: 14px 16px;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  position: relative;
  text-align: center;
}
.topbar .logout, .topbar #logout { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); margin-inline-start: 0 !important;  width: auto; }
.topbar a.logout { color: var(--muted); font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 12.5px; font-weight: 600; text-decoration: none; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); white-space: nowrap; }
.topbar a.logout:hover { color: var(--ink); border-color: #D6D3D1; }
h1 .h-mark { display: flex; justify-content: center; margin-bottom: 10px; }
h1 .h-mark .ic, h1 .h-mark .ic-lg { width: 30px; height: 30px; vertical-align: 0; }
.topbar .logo { font-size: 22px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-top: 14px;
  box-shadow: 0 1px 3px rgba(28,25,23,.05);
}
h1 { font-size: 22px; margin-bottom: 6px; }
h2 { font-size: 17px; margin-bottom: 10px; }
p.sub { color: var(--muted); font-size: 14px; }
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=tel], input[type=number], textarea {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus, textarea:focus { border-color: var(--green-dark); box-shadow: 0 0 0 3px #04785718; }
button, .btn {
  display: inline-block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: var(--on-brand);
  background: var(--green);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  margin-top: 14px;
  transition: background .15s, box-shadow .15s;
}
button:hover, .btn:hover { box-shadow: 0 6px 20px #04785733; }
button:active, .btn:active { background: var(--green-dark); transform: scale(.99); }
button.secondary, .btn.secondary { background: #fff; color: var(--green-dark); border: 1.5px solid var(--green); }
button.ghost { background: transparent; color: var(--muted); border: 0; font-size: 14px; padding: 8px; }
button.amber { background: #F5F5F4; color: var(--ink); border: 1.5px solid #D6D3D1; }
button.amber:hover { box-shadow: 0 6px 16px #00000012; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.msg { margin-top: 12px; font-size: 14px; padding: 10px 12px; border-radius: 8px; display: none; }
.msg.err { display: block; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.ok { display: block; background: #ECFDF5; color: var(--green-dark); border: 1px solid #A7F3D0; }
.msg.err:empty, .msg.ok:empty { display: none; }
.dnum { direction: ltr; unicode-bidi: isolate; display: inline-block; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.center { text-align: center; }
.big-order {
  font-family: 'Changa', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 84px;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--green-dark);
  text-align: center;
  line-height: 1.15;
  margin: 10px 0;
}
.dots::after { content: ''; animation: dots 1.4s infinite; }
@keyframes dots { 0% {content:'';} 25% {content:'.';} 50% {content:'..';} 75% {content:'...';} }
.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.order-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 10px;
  background: #fff;
}
.order-item .num {
  font-family: 'Changa', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  min-width: 74px;
}
.order-item .meta { flex: 1; font-size: 13px; color: var(--muted); }
.order-item button { width: auto; margin: 0; padding: 10px 16px; font-size: 15px; white-space: nowrap; }
.order-item.ready-item { border-color: #A7F3D0; background: #ECFDF5; }
.order-item.ready-item .num { color: var(--green-dark); }
.stats { display: flex; gap: 10px; margin-top: 14px; }
.stat { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 6px; text-align: center; }
.stat .v {
  font-family: 'Changa', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}
.stat .l { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stars button { background: none; border: 0; font-size: 40px; width: auto; margin: 0 4px; padding: 0; cursor: pointer; }
.stars button:hover { box-shadow: none; }

.note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 12px 14px; font-size: 14px; margin-top: 12px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }
#qrbox { text-align: center; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; display: inline-block; }
.mono { direction: ltr; unicode-bidi: embed; font-family: 'IBM Plex Mono', monospace; font-size: 13px; word-break: break-all; }
.tech-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: #047857A6;
  text-transform: uppercase;
  direction: ltr;
  display: inline-block;
}
h2 .tech-tag { margin-inline-start: 10px; vertical-align: 4px; }

/* monoline SVG icons */
.ic { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; }
.ic-lg { width: 28px; height: 28px; vertical-align: -7px; }
.topbar .logo { display: inline-flex; }
.topbar .logo .ic { width: 22px; height: 22px; vertical-align: 0; }
/* subtle card pattern */
.card, .stat {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='1.5' cy='1.5' r='1' fill='%231C1917' fill-opacity='0.055'/%3E%3C/svg%3E");
}
/* rating stars as SVG */
.stars button svg { width: 36px; height: 36px; fill: none; stroke: #d1d5db; stroke-width: 1.6; }
.stars button.on svg { fill: #f59e0b; stroke: #f59e0b; }
.stars button.off svg { fill: none; stroke: #d1d5db; }

/* icon-only action button */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--green-dark); cursor: pointer; transition: border-color .15s, background .15s; margin-top: 10px; }
.icon-btn:hover { border-color: var(--green-dark); background: #ECFDF5; }
.icon-btn .ic { width: 22px; height: 22px; vertical-align: 0; }
#print-qr.icon-btn { display: flex; margin: 14px auto 0; }

/* brand lockups */
.topbar .logo.brand { display: inline-flex; align-items: center; }
.brand-h { display: block; height: 26px; width: auto; }
.topbar .tb-title { font-weight: 700; }
h1.hero-logo { display: flex; justify-content: center; margin-bottom: 8px; }
h1.hero-logo img { display: block; height: 42px; width: auto; }
@media (max-width: 420px) { .brand-h { height: 23px; } h1.hero-logo img { height: 36px; } }

/* Links: brand green instead of the browser default blue */
a { color: var(--green-dark); text-decoration-color: #A7F3D0; text-underline-offset: 2px; }
a:hover { color: var(--green-dark); text-decoration-color: var(--green-dark); }

/* alarm (customer order page + cashier screen) */
.alarm-ctl { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; font-family: inherit; font-size: 14px; font-weight: 700; padding: 11px 14px; border-radius: 10px; border: 1.5px solid #FECACA; background: #FEF2F2; color: #B91C1C; margin-top: 14px; cursor: pointer; animation: alPulse 1.7s ease-in-out infinite; }
.alarm-ctl svg { width: 17px; height: 17px; flex: 0 0 auto; }
.alarm-ctl.on { border-color: #A7F3D0; background: #ECFDF5; color: var(--green-dark); animation: none; }
.alarm-sheet { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 70; background: #7F1D1D; color: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 14px 34px rgba(0,0,0,.28); animation: alFlash 1s steps(2, end) infinite; }
.alarm-sheet .al-title { font-size: 12.5px; opacity: .9; margin-bottom: 6px; }
.alarm-sheet .al-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.2); }
.alarm-sheet .al-row b { font-size: 22px; font-family: 'IBM Plex Mono', monospace; }
.alarm-sheet .al-ack { width: auto; margin: 0; flex: 0 0 auto; background: #fff; color: #7F1D1D; font-size: 13px; font-weight: 800; padding: 9px 16px; border-radius: 9px; border: 0; box-shadow: none; }
@keyframes alPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(185,28,28,.28); } 50% { box-shadow: 0 0 0 7px rgba(185,28,28,0); } }
@keyframes alFlash { 0%, 100% { background: #7F1D1D; } 50% { background: #991B1B; } }

.alarm-sheet.hidden { display: none; }
.alarm-sheet.cust .al-title { font-size: 13px; font-weight: 700; opacity: 1; margin-bottom: 4px; }

.al-test { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 70; background: #fff; border: 1.5px solid var(--green); border-radius: 12px; padding: 12px 14px; box-shadow: 0 14px 34px rgba(0,0,0,.18); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.al-test.hidden { display: none; }
.al-test .al-q { font-size: 13.5px; font-weight: 800; color: #18181b; }
.al-test .al-btns { display: flex; gap: 8px; flex: 0 0 auto; }
.al-test button { width: auto; margin: 0; flex: 0 0 auto; font-family: inherit; font-size: 13px; font-weight: 800; padding: 8px 15px; border-radius: 8px; border: 1.5px solid var(--green); background: var(--green); color: var(--on-brand); cursor: pointer; box-shadow: none; }
.al-test button.al-no { background: #fff; color: #7F1D1D; border-color: #FCA5A5; }
.alarm-ctl.fail { border-color: #FCA5A5; background: #FEF2F2; color: #991B1B; animation: none; }
.al-diag { text-align: left; direction: ltr; white-space: pre-wrap; word-break: break-all; font-family: 'IBM Plex Mono', monospace; font-size: 11px; line-height: 1.6; background: #f4f4f5; border: 1px solid #e4e4e7; border-radius: 8px; padding: 10px 12px; margin: 10px 0 0; color: #27272a; }
.al-diag.hidden { display: none; }
.alarm-ctl.check { border-color: #FDE68A; background: #FFFBEB; color: #92400E; animation: none; }

/* optional «last order» line on the customer page: small, quiet, never full width */
.last-order{display:none;width:auto;max-width:100%;margin:12px auto 0;background:transparent;border:0;
  color:var(--muted);font-size:13px;padding:6px 10px;text-decoration:underline;text-underline-offset:4px;
  box-shadow:none;font-family:inherit;cursor:pointer}
.last-order:not(.hidden){display:inline-block}
.last-order:hover{box-shadow:none;color:var(--green)}

/* diagnostics actions on the customer page: small inline buttons, never full width */
.diag-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:6px}
.diag-actions.hidden{display:none}
.diag-actions button{width:auto;flex:0 0 auto;margin-top:0;font-size:13px;padding:9px 14px}
.diag-actions .msg{flex:1 0 100%;text-align:center}

/* the customer's always-available silence button */
.mute-fab{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(16px + env(safe-area-inset-bottom));
  z-index:60;display:inline-flex;align-items:center;gap:8px;width:auto;flex:0 0 auto;margin:0;
  background:#1C1917;color:#fff;border:0;border-radius:12px;padding:12px 22px;font-size:15px;
  font-weight:700;font-family:inherit;letter-spacing:0;box-shadow:0 10px 24px #1c191755}
.mute-fab.hot{background:#B91C1C;box-shadow:0 10px 24px #b91c1c55}
.mute-fab.hidden{display:none}
.mute-fab.muted{background:#15803D;box-shadow:0 10px 24px #15803d55}
.mute-fab:active{transform:translateX(-50%) scale(.98)}
.mute-fab .ic{width:18px;height:18px}

/* ---- order state colours ----
   preparing follows the shop colour; ready is a hard attention state: the whole card
   turns solid red so a glance across the counter is enough. */
#wait-card { border: 2px solid color-mix(in srgb, var(--green) 40%, var(--line)); background: color-mix(in srgb, var(--green) 8%, var(--card)); }
.state-chip { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 18px; border-radius: 8px; background: var(--green); color: var(--on-brand); font-family: 'Alexandria', 'IBM Plex Sans Arabic', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: .2px; margin-top: 12px; }
.state-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: chipDot 1.2s ease-in-out infinite; }
@keyframes chipDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .3; transform: scale(.65); } }
#ready-card { background: #B42318; border: 3px solid #7A1A12; color: #fff; box-shadow: 0 12px 34px rgba(180, 35, 24, .38); animation: readyGlow 1.5s ease-in-out infinite; }
#ready-card h1, #ready-card p.sub, #ready-card .big-order { color: #fff; }
#ready-card .secondary { background: #fff; color: #B42318; border-color: #fff; }
@keyframes readyGlow {
  0%, 100% { box-shadow: 0 10px 26px rgba(180, 35, 24, .32); }
  50%      { box-shadow: 0 18px 48px rgba(180, 35, 24, .62); }
}

/* a plain, one-tap way out when the browser refused to play the ring */
.sound-warn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 14px; padding: 13px 16px; font-family: inherit; font-size: 14.5px; font-weight: 700; border-radius: 10px; border: 2px solid #B42318; background: #FEF2F2; color: #B42318; cursor: pointer; }
.sound-warn.hidden { display: none; }
.sound-warn .ic { width: 18px; height: 18px; flex: 0 0 auto; }

/* password show / hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-left: 48px; }
.pw-eye { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: #78716c; border-radius: 8px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pw-eye:hover { background: #F5F5F4; color: #1c1917; }
.pw-eye:active { background: #EDEBE9; }
.pw-eye:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.pw-eye svg { width: 20px; height: 20px; display: block; }
