/* Alexandria (SIL Open Font License), self-hosted. One variable file per script covers weights 400-700. */
@font-face { font-family: "Alexandria"; font-weight: 400 700; font-display: swap; src: url("/fonts/alexandria-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Alexandria"; font-weight: 400 700; font-display: swap; src: url("/fonts/alexandria-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --primary:#0155ee;
  --primary-deep:#0144be;
  --primary-gradient:linear-gradient(135deg, #3b82ff 0%, #0155ee 55%, #0a3bb0 100%);
  --primary-gradient-light:#3b82ff;
  --primary-gradient-dark:#0a3bb0;
  --accent:#a4fc01;
  --accent-press:#94e301;
  --bg:#ebeae9;
  --on-primary:#ffffff;
  --on-primary-soft:rgba(255,255,255,0.82);
  --on-primary-faint:rgba(255,255,255,0.14);
  --on-primary-line:rgba(255,255,255,0.5);
  --on-accent:#06214f;
  --ink: #06214f;
  --muted: #55617a;
  --line: #d5d4d2;
  --surface: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fbeae9;
  --pending: #8a5a00;
  --pending-bg: #fdf1d7;
  --radius: 18px;
  --shadow: 0 10px 30px rgb(6 33 79 / 10%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Alexandria", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.on-blue :focus-visible { outline-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms, transform 120ms;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-press); }
.btn-outline { border-color: var(--line); background: var(--surface); }
.btn-outline:hover:not(:disabled) { border-color: var(--ink); }
.btn-danger { border-color: var(--danger); background: var(--surface); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-on-blue { border-color: var(--on-primary-line); color: var(--on-primary); }
.btn-on-blue:hover { background: var(--on-primary-faint); }
.btn-block { width: 100%; font-size: 18px; min-height: 56px; }
.btn-small { min-height: 48px; padding: 6px 14px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 18px; }
.field label { font-weight: 500; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgb(1 85 238 / 20%); }
/* Phone and receipt boxes are always left-to-right; in an Arabic page their text sits at the right edge. */
html[dir="rtl"] .field input[dir="ltr"] { text-align: right; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.hint { color: var(--muted); font-size: 14px; }
.field-error { color: var(--danger); font-size: 14px; font-weight: 500; }
.form-error {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 500;
}
.form-success {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
}

.card {
  padding: 22px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.brand-mark { flex: none; width: 30px; height: 30px; }
.brand-mark path { fill: var(--accent); }
.brand-logo { flex: none; height: 40px; max-width: 140px; object-fit: contain; padding: 3px 6px; border-radius: 10px; background: #fff; }
a.brand { color: inherit; text-decoration: none; }

/*
 * The language toggle on customer pages: an iOS-style switch, 64x32 track inside a 44px tap area.
 * Positions are physical (the track is always ltr): Arabic = thumb on the right, English = thumb on the left.
 * The thumb covers the current language's label, so the visible label is the language you can switch to.
 */
.lang-switch {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.lang-track {
  position: relative;
  display: block;
  direction: ltr;
  width: 64px;
  height: 32px;
  border-radius: 999px;
  background: #eaf1fe;
  color: var(--primary, #0155ee);
  transition: background-color 200ms ease, color 200ms ease;
}
.lang-label {
  position: absolute;
  top: 0;
  width: 32px;
  line-height: 32px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  transition: opacity 200ms ease;
}
.lang-label-en { left: 0; }
.lang-label-ar { right: 0; }
.lang-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translateX(32px); /* Arabic: right */
  transition: transform 200ms ease;
}
.lang-switch .lang-label-ar { opacity: 0; } /* Arabic: thumb covers the Arabic label */
.lang-switch[aria-checked="true"] .lang-track { background: var(--primary-gradient); color: #fff; }
.lang-switch[aria-checked="true"] .lang-thumb { transform: translateX(0); }
.lang-switch[aria-checked="true"] .lang-label-ar { opacity: 1; }
.lang-switch[aria-checked="true"] .lang-label-en { opacity: 0; }
.lang-switch:focus-visible { outline: none; }
.lang-switch:focus-visible .lang-track { outline: 2px solid var(--primary, #0155ee); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .lang-track, .lang-label, .lang-thumb { transition: none; }
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lang-corner { display: flex; justify-content: flex-end; margin-bottom: 12px; }

/* ---------- Customer page ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 20px 16px 84px;
  background: var(--primary-gradient);
  color: var(--on-primary);
}
.hero::before {
  content: "";
  position: absolute;
  inset-block-start: -40px;
  inset-inline-start: -50px;
  width: 260px;
  height: 340px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M18 2 6 18h8l-2 12 14-18h-9z' fill='%23fff' fill-opacity='.08'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hero-inner { position: relative; max-width: 480px; margin: 0 auto; }

.ticket {
  position: relative;
  margin-top: 22px;
  padding: 20px 24px 18px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
  /* Punches the two notches that make the panel read as a voucher. */
  mask: radial-gradient(circle 13px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle 13px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
}
.ticket h1 { font-size: 20px; font-weight: 500; line-height: 1.4; }
.ticket-amount {
  display: block;
  font-size: clamp(50px, 16vw, 68px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.ticket-currency { display: block; font-weight: 700; font-size: 18px; }

.customer-main {
  position: relative;
  max-width: 480px;
  margin: -56px auto 0;
  padding: 0 16px 40px;
}
.customer-main h2 { font-size: 20px; margin-bottom: 16px; }
.customer-main form .btn { margin-top: 22px; }

.status-view { text-align: center; }
.status-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 4px auto 16px;
  border-radius: 50%;
}
.status-icon svg { width: 40px; height: 40px; }
.status-icon.pending { background: var(--pending-bg); color: var(--pending); }
.status-icon.approved { background: var(--accent); color: var(--on-accent); }
.status-icon.rejected { background: var(--danger-bg); color: var(--danger); }
.status-view h2 { margin-bottom: 8px; font-size: 21px; line-height: 1.45; }
.status-view .hint { margin-bottom: 20px; }
.receipt-pill {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--bg);
  font-weight: 500;
}

/* ---------- Login ---------- */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
  background: var(--primary-gradient);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-wrap .brand { margin-bottom: 18px; color: var(--on-primary); }
.login-wrap h1 { margin-bottom: 18px; font-size: 22px; }
.login-wrap form .btn { margin-top: 22px; }

/* ---------- Admin ---------- */
.admin-header { background: var(--primary-gradient); color: var(--on-primary); }
.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 16px;
}
.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}
.tabs-inner { display: flex; max-width: 1000px; margin: 0 auto; padding: 0 8px; }
.tab {
  flex: 1;
  min-height: 52px;
  border: 0;
  border-block-end: 4px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tab[aria-selected="true"] { border-block-end-color: var(--primary); color: var(--ink); }
.admin-main { max-width: 1000px; margin: 0 auto; padding: 16px 16px 48px; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-block-end: 4px; }
.filter {
  flex: 1 0 auto;
  min-height: 48px;
  padding: 6px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.filter[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-gradient); color: var(--on-primary); }
.filters.is-searching .filter { opacity: 0.5; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 12px 16px; }
.toolbar .search { flex: 1 1 240px; }
.toolbar input {
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.toolbar input:focus { border-color: var(--primary); outline: none; }

.entry-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.entry { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.entry-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.entry-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.entry-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.entry-meta dt { color: var(--muted); }
.entry-meta dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.entry-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }

.badge { flex: none; padding: 2px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-approved { background: var(--accent); color: var(--on-accent); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }

.empty { padding: 36px 16px; border-radius: var(--radius); background: var(--surface); color: var(--muted); text-align: center; }
.more { display: flex; justify-content: center; margin-top: 16px; }

/* ---------- Draw ---------- */
.draw-stage {
  position: relative;
  overflow: hidden;
  padding: 24px 18px;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  color: var(--on-primary);
  text-align: center;
}
.draw-prize { font-weight: 500; }
.draw-prize strong { color: var(--accent); font-size: 22px; }
.reel {
  display: grid;
  place-content: center;
  gap: 2px;
  min-height: 136px;
  margin-block: 16px;
  padding: 14px;
  border-radius: 14px;
  background: var(--primary-deep);
  overflow-wrap: anywhere;
}
.reel-name { font-size: 24px; font-weight: 700; line-height: 1.35; }
.reel-detail { color: var(--on-primary-soft); }
.reel.is-spinning .reel-name { color: var(--on-primary-soft); }
.reel.is-winner { background: var(--accent); color: var(--on-accent); animation: pop 500ms cubic-bezier(0.2, 1.4, 0.4, 1); }
.reel.is-winner .reel-detail { color: var(--on-accent); }
.reel.is-winner a { color: var(--on-accent); font-weight: 700; }
.reel-label { font-weight: 700; }
.eligible { margin-bottom: 14px; color: var(--on-primary-soft); }

@keyframes pop { from { transform: scale(0.9); } to { transform: scale(1); } }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti span {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fall 2.4s ease-in forwards;
}
@keyframes fall {
  to { transform: translateY(520px) rotate(620deg); opacity: 0.2; }
}

.section-title { margin: 26px 0 12px; font-size: 19px; }
.history { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.history li { padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.history-name { font-weight: 700; overflow-wrap: anywhere; }
.history-meta { color: var(--muted); font-size: 14px; }

dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink);
}
dialog::backdrop { background: rgb(6 33 79 / 55%); }
dialog h2 { margin-bottom: 8px; font-size: 20px; }
dialog form { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 18px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; gap: 16px; }
.settings-grid h2 { margin-bottom: 14px; font-size: 19px; }
.settings-grid form .btn { margin-top: 18px; }
.settings-grid p + .btn { margin-top: 14px; }

/* ---------- Form controls beyond text inputs ---------- */
.field select, .field textarea { width: 100%; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 17px; }
.field select { min-height: 52px; }
.field textarea { resize: vertical; line-height: 1.5; }
.field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field input[type="color"] { padding: 4px; cursor: pointer; }
.field input[type="file"] { min-height: auto; padding: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button-row .btn { flex: 1 1 auto; }
.card .btn-block + .btn-block { margin-top: 10px; }
dialog .dialog-form { display: block; margin-top: 14px; }
.section-title-first { margin-top: 0; }

/* ---------- Store home page ---------- */
.home-title { margin-top: 20px; font-size: 30px; line-height: 1.3; }

/* ---------- Opening hours: owner settings ---------- */
.hours-list { display: grid; gap: 8px; margin-top: 14px; }
.hours-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 8px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.hours-day { font-weight: 700; }
.hours-closed { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.hours-closed input, .switch-row input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
/* The two times sit on their own line, so they always have room. */
.hours-times { display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.hours-times input[type="time"] {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 6px 8px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.hours-times input[type="time"]:disabled { opacity: 0.45; }
@media (min-width: 760px) {
  .hours-row { grid-template-columns: 96px auto minmax(0, 1fr); padding: 8px 12px; }
  .hours-times { grid-column: auto; max-width: 360px; }
}
.hours-night, .hours-error { grid-column: 1 / -1; }
.closure-field { margin-top: 16px; }
.switch-row { display: flex; align-items: center; gap: 10px; min-height: 48px; font-weight: 700; cursor: pointer; }

/* ---------- Agencies and brands: owner settings ---------- */
.brand-add { display: grid; gap: 12px; margin-top: 14px; }
.brand-add .btn { justify-self: start; }
.brand-list { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.brand-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.brand-row .brand-names input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.brand-row .brand-names input[type="text"]:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgb(1 85 238 / 20%); }
.brand-thumb { display: grid; place-items: center; width: 72px; height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.brand-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-thumb .hint { font-size: 12px; text-align: center; }
.brand-actions { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: 8px; }
.brand-actions .btn[disabled] { opacity: 0.4; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; border: 0; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 760px) {
  .brand-row { grid-template-columns: 72px minmax(160px, 1fr) auto; }
  .brand-actions { grid-column: auto; }
}

/* ---------- Logo upload ---------- */
.logo-box { display: grid; place-items: center; min-height: 96px; margin-bottom: 14px; padding: 12px; border: 2px dashed var(--line); border-radius: 12px; background: var(--bg); }
.logo-box img { max-width: 100%; max-height: 120px; object-fit: contain; }
.settings-wide { grid-column: 1 / -1; }
.poster-head .brand-logo { height: 72px; max-width: 240px; }

@media (min-width: 760px) {
  .entry-list.single-column { grid-template-columns: 1fr; }
}
/* ---------- QR poster ---------- */
.qr-controls { max-width: 560px; margin: 16px auto; padding: 0 16px; }
.qr-controls .card { display: grid; gap: 14px; }
.qr-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.warning { padding: 10px 14px; border-radius: 12px; background: var(--pending-bg); color: var(--pending); font-weight: 500; }

.poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  margin: 0 auto 32px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  color: var(--on-primary);
  text-align: center;
  box-shadow: var(--shadow);
}
.poster-head { width: 100%; padding: 28px 24px 8px; }
.poster-head .brand { justify-content: center; font-size: 20px; }
.poster .ticket { width: calc(100% - 48px); margin-top: 18px; }
.poster-qr { width: min(100% - 48px, 340px); margin: 22px 0 14px; padding: 12px; border-radius: 16px; background: #fff; }
.poster-qr svg { display: block; width: 100%; height: auto; }
.poster-cta { font-size: 24px; font-weight: 700; }
.poster-steps { margin: 6px 0 12px; padding: 0 24px; color: var(--on-primary-soft); }
.poster-url { margin-bottom: 26px; padding: 0 24px; font-size: 14px; color: var(--on-primary-soft); overflow-wrap: anywhere; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .no-print { display: none !important; }
  .poster {
    max-width: none;
    width: 210mm;
    height: 296mm;
    margin: 0;
    justify-content: center;
    border-radius: 0;
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .poster-head .brand { font-size: 30px; }
  .poster-head .brand svg { width: 44px; height: 44px; }
  .poster .ticket { width: 150mm; padding-block: 28px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .poster .ticket h1 { font-size: 28px; }
  .poster .ticket-amount { font-size: 84px; }
  .poster .ticket-currency { font-size: 26px; }
  .poster-qr { width: 110mm; margin-block: 12mm 8mm; }
  .poster-cta { font-size: 36px; }
  .poster-steps { font-size: 20px; }
  .poster-url { font-size: 16px; margin-bottom: 0; }
}

@media (min-width: 760px) {
  .entry-list { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: repeat(2, 1fr); align-items: start; }
  .filters { max-width: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Workers' pay ---------- */
.workers { display: grid; gap: 14px; }
.worker-open { width: 100%; border: 0; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.worker-sub { color: var(--muted); }
.worker-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.workers .card { display: grid; gap: 14px; }
.worker-net { font-size: 20px; font-weight: 700; }
.worker-subtitle { margin: 6px 0 0; font-size: 17px; }
.worker-events { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.worker-event { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 0; border-block-end: 1px solid var(--line); }
.worker-note { flex-basis: 100%; color: var(--muted); overflow-wrap: anywhere; }
.worker-event-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.field-check { display: flex; align-items: center; gap: 10px; }
.field-check input { width: 22px; height: 22px; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset: 0; padding: 16px; background: #fff; }
  .no-print { display: none !important; }
}

/* ---------- Order tracking: the three delivery steps ---------- */
.order-steps { display: grid; gap: 10px; margin: 8px 0; padding: 0; list-style: none; text-align: start; }
.order-steps li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 2px solid var(--line); border-radius: 12px; color: var(--muted); font-weight: 500; }
.order-steps li.step-done { color: var(--ink); }
.step-icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; }
.step-icon svg { width: 18px; height: 18px; }
.step-done .step-icon { background: #1fb85c; color: #fff; }
.step-pending .step-icon { background: #ececec; color: #8a8a8a; }
.step-pending .step-icon svg { width: 20px; height: 20px; }

/* ---------- Order tracking: waiting game ---------- */
.game-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.game-bar #game-best { color: var(--muted); font-weight: 500; }
.game-close { margin-inline-start: auto; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #ececec; color: #333; font-size: 16px; cursor: pointer; }
.game-stage { position: relative; max-width: 340px; margin: 0 auto; border-radius: 12px; overflow: hidden; touch-action: manipulation; }
#game-canvas { display: block; width: 100%; height: auto; }
.game-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(11, 61, 145, 0.55); color: #fff; font-size: 20px; font-weight: 700; text-align: center; }
.game-overlay[hidden] { display: none; }

/* ---------- Orders: cashier board and the driver page ---------- */
.orders-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.orders-count { display: grid; gap: 2px; padding: 12px 6px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.orders-count strong { font-size: 24px; }
.orders-count span { color: var(--muted); font-size: 14px; }
.driver-list { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.driver-card { display: grid; gap: 14px; padding: 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.driver-name { margin: 0; font-size: 28px; overflow-wrap: anywhere; }
.driver-receipt { margin: 0; font-size: 22px; }
.driver-call, .driver-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 64px; font-size: 22px; font-weight: 700; }
.driver-card-done { padding: 14px 20px; opacity: 0.8; }
.driver-card-done .driver-name { font-size: 20px; }
.driver-card-done .driver-receipt { font-size: 16px; }
.driver-done { margin-top: 24px; }
.driver-done summary { min-height: 56px; padding: 14px 0; font-size: 22px; font-weight: 700; cursor: pointer; }
.driver-empty { font-size: 20px; }
.undo-bar { position: fixed; inset-inline: 12px; inset-block-end: 12px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 18px; }
.undo-bar .driver-btn { width: auto; min-width: 120px; }

/* Platform page: the shared catalog and the agency import. */
.plat-tabs { display: flex; gap: 8px; margin-block: 12px 4px; }
.plat-tab[aria-pressed="true"] { background: var(--primary-gradient); color: var(--on-primary); border-color: transparent; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 4px 12px; }
.cat-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 4px 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.cat-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-gradient); color: var(--on-primary); }
.cat-chip small { opacity: 0.8; }
.cat-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.cat-row img, .cat-row .cat-none { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--line); }
.cat-row strong { display: block; overflow-wrap: anywhere; }
.cat-row small { color: var(--muted); }
.cat-list { list-style: none; margin: 0; padding: 0; }
.clip-card { margin-top: 24px; padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.clip-card ol { padding-inline-start: 22px; line-height: 1.9; }
.clip-card .clip-link { display: inline-flex; align-items: center; justify-content: center; margin-block: 8px; text-decoration: none; cursor: grab; }
#cat-form textarea { width: 100%; min-height: 160px; font: inherit; }
/* Which code rule matched (public/js/code-match.js): a small label on the pick lists and suggestions. */
.rule-badge { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 8px; background: #e6f4ea; color: #1b5e20; font-size: 11px; font-weight: 600; white-space: nowrap; }
.rule-badge.rule-near { background: #fff3cd; color: #7a5a00; }
.rule-badge.rule-cut, .rule-badge.rule-longer, .rule-badge.rule-starts, .rule-badge.rule-contains, .rule-badge.rule-family { background: #eef3ff; color: #274690; }

/* Platform: "استيراد كتالوج من ملف" (public/js/catalog-import.js). */
.cimp-dialog { width: min(640px, 96vw); max-height: 92vh; overflow: auto; }
.cimp { display: grid; gap: 10px; }
.cimp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cimp-tile { display: grid; gap: 2px; padding: 10px 8px; border: 2px solid #d5dcea; border-radius: 14px; text-align: center; font-size: 13px; }
.cimp-tile strong { font-size: 24px; }
.cimp-tile.is-new { border-color: #2e9d57; }
.cimp-tile.is-error { border-color: #c62828; }
.cimp-block ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.cimp-block li { padding: 6px 8px; border-radius: 10px; background: #f4f6fb; overflow-wrap: anywhere; }
.cimp-block summary { cursor: pointer; font-weight: 600; }
.cimp-bad { color: #c62828; }
.cimp-done { font-size: 18px; font-weight: 700; }
.cimp-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.brand-names { display: grid; gap: 8px; min-width: 0; }
.brand-add-actions { display: flex; flex-wrap: wrap; gap: 10px; }
