/* The brand's faces, served from here rather than a font service: text
   renders on a slow line, and nobody's browsing reaches a third party. */
@font-face { font-family: 'Cairo'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/Cairo-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Cairo'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/Cairo-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Cairo'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/Cairo-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Cairo'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/Cairo-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/PlusJakartaSans-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/PlusJakartaSans-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/PlusJakartaSans-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/PlusJakartaSans-Bold.ttf') format('truetype'); }

/*
 * payzy — the staff dashboard and the shop portal.
 *
 * Tokens from the brand guidelines (docs/brand/README.md). Solid colours carry
 * information; the gradient appears only as brand accent, never behind an
 * amount or small text. Logical properties throughout (inline-start/end), so
 * the same rules lay out Arabic right-to-left and French/English left-to-right.
 */

:root {
  --ink: #1A1036;
  --violet: #7C5CFF;
  --ui-violet: #6843E8;
  --ui-violet-pressed: #5634CF;
  --lilac: #F3B8FF;
  --peach: #FF9E7A;
  --porcelain: #F8F1EC;
  --white: #FFFFFF;

  --canvas: var(--white);
  --card: var(--porcelain);
  --text: var(--ink);
  --text-2: #696275;
  --line: #E7DFEA;
  /* The dark canvas token is #110D21. Panels that carry the logo use the
     logo artwork's own ground, #131220 — a difference nobody can see, and the
     reason the raster logo shows no box. Back to #110D21 once vector masters
     exist. */
  --dark-canvas: #131220;
  --dark-card: #241B3B;
  --dark-text-2: #CFC6DF;

  /* Functional states: each is shown with words or an icon as well. */
  --ok: #1C7A4B;       --ok-bg: #E4F4EA;
  --warn: #8A5300;     --warn-bg: #FCEFD9;
  --bad: #B3261E;      --bad-bg: #FBE4E2;
  --info: #4B2FC9;     --info-bg: #EDE8FF;

  --gradient-core: linear-gradient(45deg, #7C5CFF 0%, #F3B8FF 52%, #FF9E7A 100%);

  --r-card: 20px;
  --r-input: 12px;
  --r-pill: 999px;
  --focus: 0 0 0 3px #FFFFFF, 0 0 0 5px var(--ui-violet);

  --font: 'Plus Jakarta Sans', 'Cairo', system-ui, sans-serif;
}

:lang(ar) { --font: 'Cairo', 'Plus Jakarta Sans', system-ui, sans-serif; }

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

/* Numbers, amounts, phone numbers and codes keep a stable reading order in
   Arabic text and line up in columns. */
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

a { color: var(--ui-violet); }
a:hover { color: var(--ui-violet-pressed); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 32px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }

.muted { color: var(--text-2); }
.small { font-size: 14px; }
.caption { font-size: 13px; color: var(--text-2); }

/* ── Frame ─────────────────────────────────────────────────────────── */

.frame { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

.side { background: var(--dark-canvas); color: var(--white); }

/* The dark column runs the full height of the page; what is in it stays in
   view while the page scrolls. */
.side-inner {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* The logo is raster artwork on its own dark ground, which is the sidebar's
   colour: it sits here without a box. Never on a light surface. */
.side .logo { display: block; padding: 8px 8px 0; }
.side .logo img { display: block; width: 168px; height: auto; }

.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--dark-text-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.side nav a:hover { background: rgba(255, 255, 255, .06); color: var(--white); }
.side nav a[aria-current="page"] { background: var(--dark-card); color: var(--white); }
.side nav a .count {
  margin-inline-start: auto;
  min-width: 24px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--ui-violet);
  color: var(--white);
  font-size: 13px;
  text-align: center;
}
.side .who { margin-top: auto; font-size: 14px; color: var(--dark-text-2); display: grid; gap: 8px; }
.side .who strong { color: var(--white); }
.side .who form { margin: 0; }
.side .who button { all: unset; cursor: pointer; color: var(--lilac); font-weight: 600; }
.side .langs { display: flex; gap: 8px; }
.side .langs a { color: var(--dark-text-2); text-decoration: none; font-size: 13px; font-weight: 600; }
.side .langs a[aria-current="true"] { color: var(--white); text-decoration: underline; }

.main { padding: 32px 40px 64px; display: grid; gap: 24px; align-content: start; max-width: 1200px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .lead { margin-top: 8px; }

/* ── Surfaces ──────────────────────────────────────────────────────── */

.card { background: var(--card); border-radius: var(--r-card); padding: 24px; display: grid; gap: 16px; align-content: start; }
.card.plain { background: var(--white); border: 1px solid var(--line); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.stat { background: var(--card); border-radius: var(--r-card); padding: 20px 24px; display: grid; gap: 4px; align-content: start; text-decoration: none; color: inherit; }
.stat .value { font-size: 32px; font-weight: 700; }
.stat .label { font-size: 14px; color: var(--text-2); font-weight: 600; }
.stat.attention { background: var(--warn-bg); }
a.stat:hover { outline: 2px solid var(--ui-violet); }

.brand-strip { height: 6px; border-radius: var(--r-pill); background: var(--gradient-core); }

/* ── Tables ────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: start; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 12px 16px; border-bottom: 1px solid var(--line); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.end, th.end { text-align: end; }
.table-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.empty { padding: 32px; text-align: center; color: var(--text-2); }

/* ── Badges: always words, colour is only a second signal ──────────── */

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.neutral { color: var(--text-2); background: #EFEAF1; }

/* Four tiles: the purchase, paid in four. */
.tiles { display: inline-flex; gap: 4px; direction: ltr; }
.tiles i { width: 14px; height: 14px; border-radius: 4px; background: #DCD4E3; }
.tiles i.paid { background: var(--ui-violet); }
.tiles i.overdue { background: var(--bad); }
.tiles i.cancelled { background: transparent; border: 1.5px dashed #BDB3C7; }

/* ── Forms ─────────────────────────────────────────────────────────── */

form.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 8px; }
.field label, .field .label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--text-2); }
.field .error { font-size: 13px; color: var(--bad); font-weight: 600; }

input[type=text], input[type=email], input[type=password], input[type=search],
input[type=tel], input[type=number], select, textarea {
  font: inherit;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid #D6CCDD;
  border-radius: var(--r-input);
  background: var(--white);
  color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--ui-violet); box-shadow: 0 0 0 3px rgba(104, 67, 232, .25); border-radius: var(--r-input); }
input[aria-invalid=true] { border-color: var(--bad); }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1.5px solid #D6CCDD; border-radius: var(--r-input); font-weight: 600; font-size: 14px; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--ui-violet); }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── Buttons: one primary per view ─────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: var(--r-input);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease-out, background-color 140ms ease-out;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ui-violet); color: var(--white); }
.btn.primary:hover { background: var(--ui-violet-pressed); color: var(--white); }
.btn.secondary { background: var(--white); color: var(--ink); border: 1.5px solid #D6CCDD; }
.btn.secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn.danger { background: var(--white); color: var(--bad); border: 1.5px solid #F0C4C0; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.block { width: 100%; min-height: 56px; }
.btn[disabled] { background: #E4DEE8; color: #8E8699; cursor: not-allowed; transform: none; }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }

/* ── Messages ──────────────────────────────────────────────────────── */

.notice { border-radius: 16px; padding: 14px 16px; font-weight: 600; font-size: 15px; display: flex; gap: 10px; align-items: flex-start; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.info { background: var(--info-bg); color: var(--info); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.caption.error { color: var(--bad); font-weight: 600; }

/* ── Definition lists (account details) ────────────────────────────── */

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; font-size: 15px; }
dl.facts dt { color: var(--text-2); font-weight: 600; }
dl.facts dd { margin: 0; }

/* ── Identity documents ────────────────────────────────────────────── */

.docs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.docs figure { margin: 0; background: var(--dark-card); border-radius: 16px; overflow: hidden; display: grid; }
.docs img { width: 100%; height: 260px; object-fit: contain; background: #0B0816; }
.docs figcaption { padding: 10px 14px; color: var(--white); font-weight: 600; font-size: 14px; }

/* ── Sign-in pages ─────────────────────────────────────────────────── */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth .brand-side { background: var(--dark-canvas); color: var(--white); display: grid; align-content: center; justify-items: start; gap: 24px; padding: 64px; position: relative; overflow: hidden; }
.auth .brand-side img { width: 280px; height: auto; position: relative; }
.auth .brand-side p { color: var(--dark-text-2); max-width: 420px; font-size: 18px; position: relative; }
/* One dominant gesture: a single arc at the edge, away from any text. */
.auth .brand-side::after { content: ""; position: absolute; inset-inline-end: -180px; bottom: -180px; width: 420px; height: 420px; border-radius: 50%; background: var(--gradient-core); opacity: .9; }
.auth .form-side { display: grid; align-content: center; padding: 64px; }
.auth .form-side .box { width: 100%; max-width: 400px; display: grid; gap: 24px; }

/* ── The till ──────────────────────────────────────────────────────── */

.till { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.amount-input { font-size: 40px !important; font-weight: 700; min-height: 80px !important; text-align: center; direction: ltr; }
.qr { background: var(--white); border-radius: var(--r-card); padding: 24px; display: grid; justify-items: center; gap: 12px; border: 1px solid var(--line); }
.qr svg { width: 260px; height: 260px; }
.code { font-size: 36px; font-weight: 700; letter-spacing: .18em; direction: ltr; }
.big-amount { font-size: 44px; font-weight: 700; }
.state-line { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 18px; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--ui-violet); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.schedule { display: grid; gap: 0; }
.schedule .line { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.schedule .line:last-child { border-bottom: none; }

@media (max-width: 960px) {
  .frame { grid-template-columns: 1fr; }
  .side-inner { position: static; height: auto; }
  .main { padding: 24px 16px 48px; }
  .grid-2, .grid-3, .grid-4, .docs, .till, .auth { grid-template-columns: 1fr; }
  .auth .brand-side { padding: 32px; }
}

/* Read by screen readers, not drawn. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
[hidden] { display: none !important; }

/* ── The hosted page: a web shop's order or a payment link, handed to the app ── */
.hosted { min-height: 100vh; background: var(--card); }
.hosted .bar { background: var(--dark-canvas); padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hosted .bar img { width: 120px; height: auto; }
.hosted .bar .langs a { color: var(--dark-text-2); }
.hosted .body { max-width: 520px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 16px; }
.hosted .qr svg { width: 220px; height: 220px; }
.hosted .only-desktop { display: grid; }
@media (max-width: 720px) { .hosted .only-desktop { display: none; } }

/* A demonstration server says so on every page. */
.demo-bar {
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  padding: 6px 16px;
}

/* The demonstration's front page. */
.welcome .body { max-width: 1080px; gap: 24px; }
.welcome h2 { font-size: 20px; }
.welcome .stack { display: grid; gap: 12px; align-content: start; }
.welcome .qr { padding: 12px; justify-self: start; }
.welcome .qr svg { width: 160px; height: 160px; }
.creds { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.creds dt { color: var(--text-2); }
.creds dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.tour { margin: 12px 0 0; padding-inline-start: 20px; display: grid; gap: 8px; }
@media (max-width: 900px) { .welcome .grid-3 { grid-template-columns: 1fr; } }
