@font-face { font-family: "Tajawal"; src: url("fonts/Tajawal-Regular.d11e9f3094b8.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Tajawal"; src: url("fonts/Tajawal-Bold.ef7c3dc2a2b8.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #F4F5F7; --surface: #FFFFFF; --ink: #1E2A38; --muted: #5D6878; --line: #DDE1E6;
  --teal: #1F5F5B; --teal-hover: #184C49; --teal-soft: #E3EFEE; --on-teal: #FFFFFF;
  --brass: #A88A5A; --ok: #1E8E5A; --ok-soft: #E2F3EA; --bad: #B8382B; --bad-soft: #FBE7E4;
  --warn: #A97F0A; --warn-soft: #FBF1D6;
  --r-s: 6px; --r-m: 12px;
  --font: "Tajawal", "Segoe UI", Tahoma, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #10161D; --surface: #18212B; --ink: #E7EBF0; --muted: #98A4B2; --line: #2A3540;
    --teal: #3E9A92; --teal-hover: #4FB0A7; --teal-soft: #17302F; --on-teal: #08201E;
    --brass: #C9A962; --ok: #3DBE7E; --ok-soft: #12301F; --bad: #E2675A; --bad-soft: #3A1916;
    --warn: #E0B53C; --warn-soft: #33290C;
  }
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--font); }
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.3rem; }
.brand svg { width: 26px; height: 30px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { padding: 6px 12px; border-radius: var(--r-s); text-decoration: none; color: var(--muted); }
.nav a[aria-current="page"], .nav a:hover { color: var(--ink); background: var(--paper); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions form { margin: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }
.narrow { max-width: 640px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 700 .95rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.btn-primary:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
.btn-danger { color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Messages */
.flash { padding: 10px 14px; border-radius: var(--r-s); margin-bottom: 18px; background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.note { padding: 10px 14px; border-radius: var(--r-s); background: var(--warn-soft); color: var(--ink); margin-bottom: 18px; border-inline-start: 4px solid var(--warn); }

/* Forms */
.form { display: grid; gap: 18px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 4px; color: var(--brass); }
.field { display: grid; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: .92rem; }
.field .help { font-size: .82rem; color: var(--muted); }
.field .err { font-size: .85rem; color: var(--bad); font-weight: 700; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=search],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface);
  color: var(--ink); font: 400 1rem var(--font); }
.theme-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.theme-pick { display: grid; gap: 6px; padding: 6px; border: 2px solid var(--line); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink); font: 700 .88rem var(--font); cursor: pointer; text-align: center; }
.theme-pick img { width: 100%; height: auto; aspect-ratio: 360 / 500; border-radius: 4px; background: var(--line); }
.theme-pick:hover { border-color: var(--muted); }
.theme-pick[aria-pressed=true] { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.pw-wrap { position: relative; display: block; }
.pw-eye { position: absolute; top: 50%; transform: translateY(-50%); right: 6px; display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: var(--r-s); background: transparent; color: var(--muted); cursor: pointer; }
.pw-eye:hover { color: var(--ink); }
.pw-wrap input { padding-right: 44px; }
[dir=rtl] .pw-eye { right: auto; left: 6px; }
[dir=rtl] .pw-wrap input { padding-right: 12px; padding-left: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.check-list { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 6px 0; }
.check-list .check { font-weight: 400; }

/* Panels & lists */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 22px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.empty { text-align: center; padding: 56px 20px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 18px; }

.event-list { list-style: none; padding: 0; margin: 0 0 32px; border-top: 1px solid var(--line); }
.event-list li { border-bottom: 1px solid var(--line); }
.event-list a { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 16px 4px; text-decoration: none; color: inherit; }
.event-list a:hover .ev-name { color: var(--teal); }
.ev-name { font-weight: 700; font-size: 1.1rem; }
.ev-meta { color: var(--muted); font-size: .92rem; }
.ev-count { grid-row: 1 / 3; grid-column: 2; align-self: center; text-align: end; font-size: .92rem; color: var(--muted); }
.ev-count b { display: block; font-size: 1.2rem; color: var(--ink); }

/* Attendance gauge: the event page's headline */
.gauge { margin-bottom: 26px; }
.gauge-num { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gauge-num .big { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge-num .of { font-size: 1.15rem; color: var(--muted); }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0 10px; }
.bar i { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width .6s ease; }
.gauge-facts { display: flex; gap: 22px; flex-wrap: wrap; font-size: .92rem; color: var(--muted); }
.gauge-facts b { color: var(--ink); font-variant-numeric: tabular-nums; }

.split { display: grid; grid-template-columns: 1fr 280px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.tabs { display: flex; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-s); padding: 2px; }
.tabs a { padding: 5px 12px; border-radius: 4px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.tabs a[aria-current="true"] { background: var(--surface); color: var(--ink); font-weight: 700; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 700; background: var(--paper); }
tr:last-child td { border-bottom: 0; }
td .gname { font-weight: 700; }
td .gnote { font-size: .8rem; color: var(--muted); }
.revoked td { opacity: .55; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--paper); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.vip { background: transparent; color: var(--brass); border: 1px solid var(--brass); }

/* Row menu */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 10; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-s); min-width: 190px; padding: 4px; box-shadow: 0 8px 24px rgba(16, 22, 29, .14); }
.menu-body a, .menu-body button { display: block; width: 100%; text-align: start; padding: 8px 10px; border: 0; background: none; color: var(--ink);
  font: 400 .92rem var(--font); text-decoration: none; border-radius: 4px; cursor: pointer; }
.menu-body a:hover, .menu-body button:hover { background: var(--paper); }
.menu-body form { margin: 0; }
.menu-body hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-body .danger { color: var(--bad); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.feed li span:last-child { color: var(--muted); white-space: nowrap; }
.side h3 { color: var(--brass); }
.side .btn { width: 100%; justify-content: center; margin-bottom: 8px; }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; align-items: center; }

@media (max-width: 680px) {
  .hide-sm { display: none; }
  th, td { padding: 10px; }
  .gauge-num .big { font-size: 2.4rem; }
}

/* Login */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .brand { justify-content: center; font-size: 1.8rem; margin-bottom: 6px; }
.login-box .brand svg { width: 34px; height: 40px; }
.login-box .sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.login-lang { text-align: center; margin-top: 18px; }
.login-forgot { text-align: center; margin: 4px 0 0; font-size: .9rem; }

/* Local setup */
.qr-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.qr-steps .panel { text-align: center; }
.qr-steps svg.qr { width: 220px; height: 220px; background: #fff; border-radius: var(--r-s); }
.qr-steps code { display: block; font-size: .8rem; word-break: break-all; color: var(--muted); margin-top: 8px; }
.note-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.note-row form { margin: 0; }
.side form { margin: 0; }

/* Card placement editor */
.placer-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; border-radius: var(--r-s); overflow: hidden; border: 1px solid var(--line); touch-action: none; user-select: none; }
.placer-stage img { max-width: 100%; max-height: 70vh; display: block; }
.placer-qr { position: absolute; aspect-ratio: 1; background: rgba(255, 255, 255, .92); border: 2px solid var(--teal); border-radius: 8px; cursor: grab; display: grid; place-items: center;
  box-shadow: 0 0 0 9999px rgba(16, 22, 29, .18); }
.placer-qr span { font: 700 .9rem var(--font); color: var(--teal); line-height: 1; }
.placer-qr:active { cursor: grabbing; }
.placer-name { position: absolute; left: 7%; right: 7%; transform: translateY(-50%); border-top: 2px dashed currentColor; border-bottom: 2px dashed currentColor;
  text-align: center; font: 700 1rem/1.8 var(--font); cursor: ns-resize; background: rgba(255, 255, 255, .35); }
.placer-range { display: flex; gap: 10px; align-items: center; font-weight: 700; margin: 8px 0; }
.placer-range input { flex: 1; accent-color: var(--teal); }
.placer-opts { display: flex; gap: 22px; flex-wrap: wrap; }
.placer-opts input[type=color] { width: 42px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 4px; }

/* Packages on the booking form */
.pkgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.pkg { position: relative; display: block; border: 2px solid var(--line); border-radius: var(--r-m); padding: 16px; cursor: pointer; background: var(--surface); }
.pkg input { position: absolute; opacity: 0; }
.pkg:has(input:checked) { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.pkg:has(input:focus-visible) { outline: 3px solid var(--brass); outline-offset: 2px; }
.pkg-name { font-weight: 700; font-size: 1.1rem; }
.pkg-price { font-size: 1.5rem; font-weight: 700; color: var(--teal); margin: 4px 0; font-variant-numeric: tabular-nums; }
.pkg-desc { font-size: .88rem; color: var(--muted); margin: 0 0 8px; }
.pkg ul { margin: 0; padding-inline-start: 18px; font-size: .86rem; }
.pkg li.no { color: var(--muted); text-decoration: line-through; }

/* Customer page */
.status-hero { border-radius: var(--r-m); padding: 20px 22px; margin-bottom: 22px; border: 1px solid var(--line); background: var(--surface); border-inline-start: 6px solid var(--muted); }
.status-hero.pending { border-inline-start-color: var(--warn); }
.status-hero.changes { border-inline-start-color: var(--brass); }
.status-hero.approved { border-inline-start-color: var(--ok); }
.status-hero.rejected, .status-hero.cancelled { border-inline-start-color: var(--bad); }
.status-hero h1 { margin: 0 0 6px; }
.status-hero blockquote { margin: 10px 0 0; padding: 10px 14px; background: var(--paper); border-radius: var(--r-s); white-space: pre-line; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 700; }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--r-s); padding: 10px; margin-top: 10px; }
.linkbox code { flex: 1; min-width: 200px; word-break: break-all; font-size: .82rem; direction: ltr; text-align: left; }
.inline-form { display: grid; grid-template-columns: 2fr 1.3fr .8fr .8fr auto; gap: 8px; align-items: end; }
@media (max-width: 760px) { .inline-form { grid-template-columns: 1fr 1fr; } }
.card-img { max-width: 100%; border-radius: var(--r-s); border: 1px solid var(--line); display: block; }
.share-box { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.share-box svg.qr { width: 132px; height: 132px; background: #fff; border-radius: var(--r-s); }
@media (max-width: 600px) { .share-box { grid-template-columns: 1fr; } }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 20px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
/* Row menus must not be clipped by the table container */
.table-wrap { overflow: visible; }
.table-wrap thead th:first-child { border-start-start-radius: var(--r-m); }
.table-wrap thead th:last-child { border-start-end-radius: var(--r-m); }
