/* Khatwa partner portal: one stylesheet.
 *
 * Same family as the admin app (website/dashboard/public/app.css) and the iOS
 * app (DesignSystem/Theme.swift): maroon and gold, hairline cards, capsule
 * buttons, the deep maroon bar in both modes. Friendlier and larger than the
 * admin, because the people using it are at a counter, often on a tablet or a
 * phone: 16px text, 48px controls, one column until there is room for two.
 *
 * Colours are roles, never literal values in the rules below. Light is the
 * default; dark follows the system unless the person picked one (data-theme). */
:root {
  --bar: #8A1538; --on-bar: #FFFFFF; --on-bar-2: rgba(255,255,255,.78);
  --brand: #8A1538; --brand-press: #6E1029; --on-brand: #FFFFFF;
  --brand-text: #8A1538; --brand-tint: #F6E9ED;
  --gold-text: #7A5F16; --gold-soft: #F7EFDA;
  --success: #147A52; --success-soft: #E3F4EC;
  --danger: #B93030; --danger-soft: #FBE9E9;
  --bg: #F5F5F8; --surface: #FFFFFF; --surface-2: #F0F0F4;
  --border: rgba(23,23,32,.10); --field: #8E8E9C; --row: rgba(23,23,32,.07);
  --text: #171720; --text-2: #52525F; --text-3: #6B6B78;
  --focus: #8A1538;
  --test-text: #7A5F16; --test-edge: #B98B1E; --test-row: #FBF6E8;
  --shadow: 0 1px 2px rgba(23,23,32,.05), 0 6px 20px rgba(23,23,32,.05);
  --shadow-up: 0 12px 40px rgba(23,23,32,.18);
  --r-card: 18px; --r-control: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-text: #F28BA6; --brand-tint: #2E1820;
    --gold-text: #E0C77A; --gold-soft: #2A2416;
    --success: #35C88A; --success-soft: #13291F;
    --danger: #EE7A7A; --danger-soft: #2E1717;
    --bg: #0E0E12; --surface: #1A1A21; --surface-2: #24242C;
    --border: rgba(255,255,255,.08); --field: #7A7A88; --row: rgba(255,255,255,.06);
    --text: #F4F4F7; --text-2: #B0B0BD; --text-3: #92929F;
    --focus: #F28BA6;
    --test-text: #E0C77A; --test-edge: #B98B1E; --test-row: #211D14;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --shadow-up: 0 12px 40px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-text: #F28BA6; --brand-tint: #2E1820;
  --gold-text: #E0C77A; --gold-soft: #2A2416;
  --success: #35C88A; --success-soft: #13291F;
  --danger: #EE7A7A; --danger-soft: #2E1717;
  --bg: #0E0E12; --surface: #1A1A21; --surface-2: #24242C;
  --border: rgba(255,255,255,.08); --field: #7A7A88; --row: rgba(255,255,255,.06);
  --text: #F4F4F7; --text-2: #B0B0BD; --text-3: #92929F;
  --focus: #F28BA6;
  --test-text: #E0C77A; --test-edge: #B98B1E; --test-row: #211D14;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  --shadow-up: 0 12px 40px rgba(0,0,0,.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh;
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* Numbers keep Western digits in Arabic too (FR-LOC-003). */
[dir="rtl"] body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--brand-text); }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.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; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 300; padding: 10px 16px; border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-up); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bar :focus-visible { outline-color: #FFFFFF; }

/* ---------------------------------------------------------------- the bar */
.bar { background: var(--bar); color: var(--on-bar); padding-top: env(safe-area-inset-top); position: sticky; top: 0; z-index: 60; }
.bar__in { max-width: 1120px; margin-inline: auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 64px; }
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: none; color: var(--on-bar); text-decoration: none; border-radius: 8px; }
.brand__name { font-size: 19px; font-weight: 800; letter-spacing: .14em; }
[dir="rtl"] .brand__name { letter-spacing: 0; font-size: 21px; }
.brand__tag { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-bar-2); }
[dir="rtl"] .brand__tag { letter-spacing: 0; text-transform: none; }
.bar__spacer { flex: 1; }
.bar__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px;
  padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255,255,255,.14); color: var(--on-bar);
  font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer; white-space: nowrap;
}
.bar__btn:hover { background: rgba(255,255,255,.22); }
.bar__btn, .bar__btn:visited { text-decoration: none; }
.bar__btn.icon { padding: 0; width: 44px; }
.bar__btn svg { width: 20px; height: 20px; }

/* top nav: pills on the bar, only where there is room for them */
.topnav { display: none; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.18); margin-inline: 8px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  color: var(--on-bar-2); text-decoration: none; font-size: 15px; font-weight: 600; white-space: nowrap;
}
.topnav a:hover { color: var(--on-bar); }
.topnav a[aria-current="page"] { background: #FFFFFF; color: #8A1538; }
.topnav svg { width: 18px; height: 18px; }
.dot { display: inline-block; min-width: 8px; height: 8px; border-radius: 999px; background: #E0C77A; }
.topnav a[aria-current="page"] .dot { background: #8A6D1E; }

/* bottom tab bar on phones */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 60; background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; padding: 6px 2px;
  color: var(--text-3); text-decoration: none; font-size: 11.5px; font-weight: 600; position: relative; text-align: center; line-height: 1.15;
}
.tabbar a[aria-current="page"] { color: var(--brand-text); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; inset-inline: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand-text); }
.tabbar svg { width: 24px; height: 24px; }
.tabbar .dot { position: absolute; top: 9px; inset-inline-start: calc(50% + 8px); border: 2px solid var(--surface); min-width: 12px; height: 12px; background: #B98B1E; }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
}
@media (max-width: 899px) {
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .brand__tag { display: none; }
  .bar__btn.lang { padding: 0 10px; }
}

/* ---------------------------------------------------------------- page */
.main { max-width: 1120px; margin-inline: auto; padding: 20px 16px 64px; outline: none; }
.narrow { max-width: 520px; margin-inline: auto; }
.page-head { display: flex; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-head__titles { flex: 1; min-width: 200px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.015em; line-height: 1.15; }
[dir="rtl"] .page-title { letter-spacing: 0; }
.page-sub { color: var(--text-2); font-size: 15px; margin-top: 4px; }
.partner-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.partner-head__name { font-size: 22px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.partner-head .sub { font-size: 14px; }
.switcher { margin: 0 0 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; margin: 26px 0 10px; }
[dir="rtl"] .section-title { letter-spacing: 0; text-transform: none; font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; min-width: 0; }
.card.flat { box-shadow: none; }
.card.tight { padding: 16px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head__titles { flex: 1; min-width: 0; }
.card h2 { font-size: 19px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.card h3 { font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.sub { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.note { color: var(--text-2); font-size: 14px; margin: 0 0 14px; }
.grid { display: grid; gap: 16px; }
.grid > .card { margin-bottom: 0; }
@media (min-width: 700px) {
  .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1000px) { .grid.home { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row.top { align-items: flex-start; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.cols { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 640px) { .cols { grid-template-columns: 1fr 1fr; } .cols.three { grid-template-columns: 1fr 1fr 1fr; } }
.divider { height: 1px; background: var(--row); margin: 18px 0; border: 0; }

/* ---------------------------------------------------------------- buttons */
button { font-family: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1.5px solid transparent; font-family: inherit; font-weight: 600; font-size: 16px; line-height: 1.1; cursor: pointer; text-decoration: none;
  background: var(--surface-2); color: var(--text); transition: transform .14s ease, filter .14s ease, background .14s ease; text-align: center;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.primary:hover:not(:disabled) { background: var(--brand-press); }
.btn.secondary { background: transparent; color: var(--brand-text); border-color: var(--brand-text); }
.btn.secondary:hover:not(:disabled) { background: var(--brand-tint); }
.btn.quiet { background: transparent; color: var(--brand-text); padding: 0 12px; }
.btn.quiet:hover:not(:disabled) { background: var(--brand-tint); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }
:root[data-theme="dark"] .btn.danger.solid { color: #1A1A21; }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; }
.linkbtn { background: none; border: 0; padding: 10px 4px; min-height: 44px; color: var(--brand-text); font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.actions.end { justify-content: flex-end; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.form-actions .btn { flex: 1 1 200px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation-duration: .001s !important; } .btn:active { transform: none !important; } }

/* segmented control (sub-pages) */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0;
  background: transparent; color: var(--text-2); text-decoration: none; font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1; cursor: pointer; white-space: nowrap;
}
.seg a[aria-current="page"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (min-width: 700px) { .seg { display: inline-flex; } .seg a, .seg button { flex: 0 0 auto; } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand-text); border-color: var(--brand-text); }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 16px; min-width: 0; }
label, .label { display: block; font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.label-opt { font-weight: 400; color: var(--text-3); }
input, select, textarea {
  width: 100%; font-family: inherit; font-weight: 400; font-size: 16px; line-height: 1.3; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--field); border-radius: var(--r-control); padding: 0 14px; min-height: 50px; margin: 0;
}
select { padding-inline-end: 36px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat; }
[dir="rtl"] select { background-position: 14px 22px, 20px 22px; }
textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.45; }
input[type="file"] { padding: 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: transparent; }
input:disabled, textarea:disabled, select:disabled { opacity: .7; cursor: default; }
[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.field-hint { font-size: 13.5px; color: var(--text-3); margin-top: 6px; }
.field-error { font-size: 14px; color: var(--danger); font-weight: 600; margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.field-error svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; font-size: 16px; color: var(--text); font-weight: 400; margin: 0; }
.check input { width: 24px; height: 24px; min-height: 0; margin: 0; accent-color: var(--brand); flex: none; }
.check .sub { display: block; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { padding: 0; font-size: 14px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { flex: 1; min-width: 0; }

/* the switch (Ambertide), sized for a finger */
.toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; margin: 0; font-size: 16px; color: var(--text); font-weight: 400; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle__track { position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--field); flex: none; transition: background .15s ease; }
.toggle__track::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 22px; height: 22px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .15s ease; }
.toggle input:checked + .toggle__track { background: var(--brand); box-shadow: none; }
.toggle input:checked + .toggle__track::after { transform: translateX(20px); }
[dir="rtl"] .toggle input:checked + .toggle__track::after { transform: translateX(-20px); }
.toggle input:focus-visible + .toggle__track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------------- status */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-text); line-height: 1.3;
}
.badge svg { width: 14px; height: 14px; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.off { background: var(--surface-2); color: var(--text-2); }
.badge.brand { background: var(--brand-tint); color: var(--brand-text); }

.callout { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; border-radius: var(--r-control); padding: 12px 14px; margin: 12px 0 0; background: var(--gold-soft); color: var(--text); }
.callout svg { width: 20px; height: 20px; flex: none; color: var(--gold-text); margin-top: 1px; }
.callout.bad { background: var(--danger-soft); }
.callout.bad svg { color: var(--danger); }
.callout.ok { background: var(--success-soft); }
.callout.ok svg { color: var(--success); }
.callout.info { background: var(--surface-2); }
.callout.info svg { color: var(--text-2); }
.callout b { font-weight: 700; }

.msg { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 14px 16px; font-size: 15px; font-weight: 600; margin: 0 0 16px; }
.msg svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.ok { background: var(--success-soft); color: var(--success); }

.toast {
  position: fixed; z-index: 250; inset-inline: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); margin-inline: auto; max-width: 440px;
  background: var(--text); color: var(--bg); border-radius: 14px; padding: 14px 18px; font-weight: 600; font-size: 15px; box-shadow: var(--shadow-up);
  display: flex; gap: 10px; align-items: center;
}
.toast svg { width: 20px; height: 20px; flex: none; color: var(--bg); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.loading { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--text-2); padding: 36px 12px; font-size: 15px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--brand-text); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 30px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-2); }
.empty__icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-text); }
.empty__icon svg { width: 26px; height: 26px; }
.empty b { color: var(--text); font-size: 17px; }
.empty p { max-width: 420px; font-size: 15px; }

/* ---------------------------------------------------------------- home */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; min-width: 0; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--brand-text); }
.kpi__label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.kpi__value { font-size: 34px; font-weight: 800; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi__value .skeleton { display: inline-block; width: 56px; height: 34px; vertical-align: middle; }
.kpi__foot { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.pinbox {
  font: 700 40px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .22em; text-align: center; color: var(--brand-text);
  padding: 22px 0; background: var(--surface-2); border-radius: 14px; margin: 14px 0; direction: ltr; user-select: all;
}
.pinbox.masked { color: var(--text-3); letter-spacing: .34em; user-select: none; }

.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--row); }
.todo li:last-child { border-bottom: 0; padding-bottom: 0; }
.todo li:first-child { padding-top: 0; }
.todo__icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--gold-soft); color: var(--gold-text); }
.todo__icon.bad { background: var(--danger-soft); color: var(--danger); }
.todo__icon svg { width: 18px; height: 18px; }
.todo b { display: block; font-weight: 700; overflow-wrap: anywhere; }

.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick a, .quick button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; min-height: 88px; border-radius: 14px;
  background: var(--surface-2); color: var(--text); text-decoration: none; font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1.25; border: 1px solid transparent; cursor: pointer; text-align: start;
}
.quick a:hover, .quick button:hover { border-color: var(--brand-text); }
.quick svg { width: 22px; height: 22px; color: var(--brand-text); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--row); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 15px; direction: ltr; unicode-bidi: isolate; }

/* ---------------------------------------------------------------- vouchers */
.voucher__top { display: flex; align-items: flex-start; gap: 12px; }
.voucher__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); font-size: 14px; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat__value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat__label { font-size: 13px; color: var(--text-2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }

.logo { width: 64px; height: 64px; border-radius: 16px; background: #FFFFFF; object-fit: contain; border: 1px solid var(--border); flex: none; }
.logo.lg { width: 88px; height: 88px; border-radius: 20px; }
.mono-logo { width: 64px; height: 64px; border-radius: 16px; background: var(--brand-tint); color: var(--brand-text); display: grid; place-items: center; font-weight: 800; font-size: 26px; flex: none; }
.mono-logo.lg { width: 88px; height: 88px; border-radius: 20px; font-size: 34px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-card); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: start; font-size: 13px; font-weight: 700; color: var(--text-2); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
td { padding: 12px 14px; border-bottom: 1px solid var(--row); vertical-align: top; color: var(--text); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
td .code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
/* Phones: every row becomes a card, each cell labelled from its column. */
@media (max-width: 760px) {
  .table-wrap.stackable { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .stackable table, .stackable tbody, .stackable tr, .stackable td { display: block; width: 100%; }
  .stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stackable tr { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 8px 14px; margin-bottom: 12px; }
  .stackable td { border: 0; padding: 6px 0; display: flex; gap: 12px; justify-content: space-between; text-align: end; }
  .stackable td::before { content: attr(data-label); color: var(--text-2); font-size: 14px; font-weight: 600; text-align: start; flex: none; max-width: 45%; }
  .stackable td.num { text-align: end; }
  .stackable td > * { min-width: 0; overflow-wrap: anywhere; }
}
.pager { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; color: var(--text-2); font-size: 14px; }

/* ---------------------------------------------------------------- integrations */
.pos-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .pos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .pos-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pos-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 96px; padding: 14px; border-radius: 16px; text-align: start;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); text-decoration: none; cursor: pointer; font: inherit;
}
.pos-tile:hover { border-color: var(--brand-text); }
.pos-tile b { font-size: 17px; }
.pos-tile span { font-size: 13.5px; color: var(--text-2); line-height: 1.35; }
.pos-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: var(--brand-tint); color: var(--brand-text); }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps > li { counter-increment: step; position: relative; padding-inline-start: 46px; padding-bottom: 16px; min-height: 36px; }
.steps > li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; background: var(--brand-tint); color: var(--brand-text);
}
.steps > li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 15px; top: 34px; bottom: 2px; width: 2px; background: var(--row); }
.steps > li:last-child { padding-bottom: 0; }
.steps b { font-weight: 700; }
.steps code, .prose code { font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; counter-reset: flow; }
@media (max-width: 760px) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.flow li { list-style: none; background: var(--surface-2); border-radius: 14px; padding: 14px; font-size: 14.5px; counter-increment: flow; }
.flow li::before { content: counter(flow); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #FFFFFF; font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.flow { padding: 0; margin: 0; }

.secret {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--field); border-radius: 12px; padding: 10px 10px 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; direction: ltr; overflow-wrap: anywhere; word-break: break-all;
}
.secret > span { flex: 1; min-width: 0; }
.kbd-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 15px; }
.kbd-list dt { color: var(--text-2); }
.kbd-list dd { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- dialog */
dialog {
  border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-up);
}
dialog::backdrop { background: rgba(10,10,14,.55); }
.dialog__body { padding: 22px; overflow-y: auto; }
.dialog__body h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.dialog__body p { color: var(--text-2); margin-bottom: 14px; }
.dialog__actions { display: flex; gap: 10px; flex-wrap: wrap-reverse; justify-content: flex-end; margin-top: 18px; }
.dialog__actions .btn { flex: 1 1 160px; }

/* ---------------------------------------------------------------- sign-in */
.auth { max-width: 460px; margin: 24px auto 0; }
.auth .card { padding: 26px; }
.auth__title { font-size: 26px; font-weight: 800; line-height: 1.2; margin-bottom: 6px; }
.auth__lede { color: var(--text-2); margin-bottom: 20px; }
.auth__foot { text-align: center; margin-top: 8px; }
.auth__note { color: var(--text-3); font-size: 13.5px; text-align: center; margin-top: 14px; display: flex; gap: 6px; justify-content: center; align-items: center; }
.auth__note svg { width: 16px; height: 16px; }

.foot { max-width: 1120px; margin: 0 auto; padding: 0 16px 32px; color: var(--text-3); font-size: 13.5px; display: flex; gap: 8px 16px; flex-wrap: wrap; justify-content: center; }
.foot a { color: var(--text-2); }
@media (max-width: 899px) { .foot { display: none; } }
.bullets { list-style: none; padding: 0; margin: 16px 0 0; }
.bullets li { position: relative; padding-inline-start: 22px; margin-bottom: 12px; }
.bullets li::before { content: ""; position: absolute; inset-inline-start: 4px; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-text); }
.bullets code { font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
td.nowrap { white-space: nowrap; }
.voucher__meta span + span::before { content: "·"; margin-inline-end: 14px; color: var(--text-3); }
.voucher__meta { gap: 4px 0; }
.voucher__meta span + span { margin-inline-start: 14px; }
/* Home on a phone or small tablet: one column, and the counter PIN first. */
@media (max-width: 999px) {
  .grid.home > .stack { display: contents; }
  .grid.home > .stack > * { margin-top: 0; }
  .grid.home .pin-card { order: -1; }
}
@media (max-width: 480px) {
  .seg { overflow-x: visible; }
  .seg a, .seg button { flex: 1 1 0; min-width: 0; white-space: normal; text-align: center; line-height: 1.2; padding: 6px 8px; font-size: 14px; }
}

/* ---------------------------------------------------------------- test mode (0050) */
/* LIVE is the brand's own colour; TEST is dashed and gold, so a test key or
   event never reads as a real one, at a glance or in grey. */
.badge.livemode { background: var(--brand-tint); color: var(--brand-text); letter-spacing: .04em; }
.badge.testmode { background: transparent; color: var(--test-text); box-shadow: inset 0 0 0 1.5px var(--test-edge); letter-spacing: .04em;
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--gold-soft) 6px 12px); }
[dir="rtl"] .badge.livemode, [dir="rtl"] .badge.testmode { letter-spacing: 0; }
tr.is-test td { background: var(--test-row); }
tr.is-test td:first-child { box-shadow: inset 4px 0 0 var(--test-edge); }
[dir="rtl"] tr.is-test td:first-child { box-shadow: inset -4px 0 0 var(--test-edge); }
@media (max-width: 760px) {
  .stackable tr.is-test { background: var(--test-row); border-inline-start: 4px solid var(--test-edge); }
  .stackable tr.is-test td, [dir="rtl"] .stackable tr.is-test td:first-child, .stackable tr.is-test td:first-child { background: transparent; box-shadow: none; }
}
.test-intro .card-head { align-items: center; }
.test-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--test-text);
  box-shadow: inset 0 0 0 1.5px var(--test-edge); background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--gold-soft) 6px 12px); }
.test-mark svg { width: 22px; height: 22px; }
.test-intro .note code, .callout code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
.test-hint { margin-top: 0; }
.event { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sub.block { display: block; margin-top: 4px; }
.code-copy { display: inline-flex; align-items: center; gap: 2px; }
.iconbtn { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; margin: -10px 0; border: 0; border-radius: 999px; background: transparent; color: var(--brand-text); cursor: pointer; }
.iconbtn:hover { background: var(--brand-tint); }
.row-actions { display: flex; gap: 8px; flex-wrap: nowrap; justify-content: flex-end; }
td.actions-cell { width: 1%; white-space: nowrap; }
@media (max-width: 760px) {
  td.actions-cell { width: 100%; white-space: normal; padding-top: 10px; }
  td.actions-cell::before { display: none; }
  .row-actions { justify-content: flex-start; width: 100%; flex-wrap: wrap; }
  .row-actions .btn { flex: 1 1 auto; }
}
/* A small segmented choice inside a form or a dialog. */
.seg.compact { display: inline-flex; margin-bottom: 0; }
.seg.compact button { flex: 0 0 auto; min-height: 40px; padding: 0 14px; font-size: 14.5px; }
.seg.compact button svg { width: 18px; height: 18px; }
@media (max-width: 480px) { .seg.compact button { flex: 1 1 0; } .field > .seg.compact { display: flex; } }

/* ---------------------------------------------------------------- team (0050) */
.people { list-style: none; padding: 0; margin: 0; }
.person { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--row); }
.person:last-child { border-bottom: 0; padding-bottom: 0; }
.person:first-child { padding-top: 0; }
.person > .grow { min-width: 180px; }
.person__avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--brand-tint); color: var(--brand-text); font-weight: 800; }
.person.inactive .person__avatar { background: var(--surface-2); color: var(--text-3); }
.person.inactive .person__name bdi { color: var(--text-2); }
.person__name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; overflow-wrap: anywhere; }
.person__tags { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-top: 6px; }
.person__tags .sub { display: inline-flex; align-items: center; gap: 4px; }
.person__tags svg { width: 14px; height: 14px; color: var(--text-3); }
.person .field-hint { margin-top: 6px; }
.person__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
@media (max-width: 600px) { .person__actions { width: 100%; margin-inline-start: 0; padding-inline-start: 52px; } }
@media (max-width: 400px) { .person__actions { padding-inline-start: 0; } }
.list li.invite { align-items: flex-start; flex-wrap: wrap; }
.list li.invite > .grow { flex-basis: 100%; }
.list li.invite .person__actions { margin-inline-start: 0; padding-inline-start: 0; width: auto; }
.invite__email { font-weight: 700; overflow-wrap: anywhere; }
textarea.message-box { min-height: 200px; font-size: 15px; background: var(--surface-2); }
