/* BigoIraq Wallet — Arabic-first operator console.
   One bold element: the gradient balance card on the account page. Everything
   else stays quiet so balances and their provenance read first. */

@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-arabic-400-normal.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: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-arabic-500-normal.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: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-arabic-600-normal.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: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-arabic-700-normal.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: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Plex Arabic'; font-weight: 600; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url('/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212; }

:root {
  --ink: #1d1b3a;
  --ink-2: #47446a;
  --muted: #6c6890;
  --paper: #f4f3fb;
  --surface: #ffffff;
  --line: #e3e1f1;
  --line-strong: #cbc7e6;
  --iris: #5446d6;
  --iris-ink: #3a2fae;
  --iris-wash: #eeecfd;
  --cobalt: #2f6fe4;
  --plum: #7b3dc6;
  --ok: #0f7a55;
  --ok-bg: #e3f4ec;
  --warn: #8f5400;
  --warn-bg: #fbefd9;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 28px;
  --font: 'Plex Arabic', 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.65 var(--font);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--iris-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--iris); outline-offset: 2px; border-radius: 6px; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; }
.skip { position: absolute; inset-inline-start: 12px; top: -48px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r-s); z-index: 50; }
.skip:focus { top: 12px; }
.noscript { padding: 24px; }

/* ---------- buttons & fields ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--iris); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--iris); border-color: var(--iris); color: #fff; }
.btn-primary:hover { background: var(--iris-ink); border-color: var(--iris-ink); }
.btn-danger { color: var(--bad); border-color: #f0c4bf; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--iris-ink); }
.btn-quiet:hover { background: var(--iris-wash); }
.btn-wide { width: 100%; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--line-strong) var(--line-strong) var(--iris) var(--iris); animation: spin .8s linear infinite; }
.btn-primary.busy::after { border-color: rgba(255,255,255,.4) rgba(255,255,255,.4) #fff #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--iris-wash); color: var(--iris-ink); }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface);
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--iris); box-shadow: 0 0 0 3px rgba(84,70,214,.18); }
.input-ltr { direction: ltr; text-align: right; letter-spacing: .04em; }
.input-code { direction: ltr; text-align: center; font-size: 24px; letter-spacing: .3em; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--iris); }
.form { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-size: 14px; }
.alert .ic { margin-top: 2px; }
.alert-info { background: var(--iris-wash); color: var(--iris-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert small { display: block; opacity: .85; margin-top: 2px; }

/* ---------- gate (login / MFA) ---------- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-panel { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 32px 28px; display: grid; gap: 18px; }
.gate-panel .mark { width: 48px; height: 48px; }
.steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; color: var(--ink-2); font-size: 14px; }
.qr { display: grid; place-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: #fff; }
.qr img { width: 200px; height: 200px; image-rendering: pixelated; }
.secret { direction: ltr; text-align: center; font-weight: 600; letter-spacing: .08em; padding: 10px; border-radius: var(--r-s); background: var(--paper); word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.codes li { direction: ltr; text-align: center; font-weight: 600; letter-spacing: .06em; padding: 8px; background: var(--paper); border-radius: var(--r-s); }

/* ---------- shell ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1180px) / 2)); background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; white-space: nowrap; }
.mark { width: 32px; height: 32px; }
.switch { display: flex; gap: 4px; padding: 4px; background: var(--paper); border-radius: 14px; margin-inline-start: 12px; }
.switch a { padding: 7px 18px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.switch a[aria-current='page'] { background: var(--surface); color: var(--iris-ink); box-shadow: 0 1px 2px rgba(29,27,58,.12); }
.util { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.util a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.util a:hover, .util a[aria-current='page'] { background: var(--iris-wash); color: var(--iris-ink); }
.who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; direction: ltr; padding-inline: 8px; }
.page { width: min(1180px, 100%); margin: 0 auto; padding: 28px 16px 64px; display: grid; gap: 22px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.panel { grid-template-columns: minmax(0, 1fr); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.toolbar select.input { width: auto; flex: 0 1 220px; }
.search { position: relative; flex: 1 1 280px; }
.search .ic { position: absolute; inset-inline-start: 14px; top: 13px; color: var(--muted); }
.search .input { padding-inline-start: 44px; }

.notice { display: grid; gap: 10px; padding: 18px 20px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--warn); }
.notice ul { margin: 0; padding-inline-start: 20px; color: var(--ink-2); font-size: 14px; display: grid; gap: 4px; }

/* ---------- account cards ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.acct {
  position: relative; display: grid; gap: 10px; padding: 18px 20px 16px; border-radius: var(--r-m);
  background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none;
}
.acct::before { content: ''; position: absolute; inset-block: 16px; inset-inline-start: 0; width: 4px; border-radius: 0 4px 4px 0; background: var(--line-strong); }
.acct.conn-linked::before { background: var(--ok); }
.acct.conn-expired::before { background: var(--bad); }
.acct.conn-unsupported::before { background: var(--line); }
.acct:hover { border-color: var(--iris); }
.acct-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.acct-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-num { font-size: 21px; font-weight: 600; }
.acct-bal { display: grid; gap: 2px; padding-top: 10px; border-top: 1px dashed var(--line); }
.acct-bal strong { font-size: 22px; font-weight: 700; }
.acct-bal strong small { font-size: 14px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.acct-op { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--warn); font-weight: 500; }
.acct-foot { font-size: 12.5px; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--paper); color: var(--ink-2); }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.idle { color: var(--muted); }
.tone-ok { color: var(--ok); }
.tone-stale { color: var(--warn); }
.tone-muted { color: var(--muted); }

.empty { display: grid; justify-items: center; gap: 12px; padding: 48px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-m); color: var(--ink-2); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; }

/* ---------- balance card (after the reference photo) ---------- */

.wallet { border-radius: var(--r-l); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.wallet-top {
  position: relative; padding: 26px 28px 30px; color: #fff; display: grid; gap: 6px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(84,140,255,.55) 0%, rgba(84,140,255,0) 55%),
    linear-gradient(135deg, var(--cobalt) 0%, #5a49d8 52%, var(--plum) 100%);
}
.wallet-who { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 500; }
.wallet-who .chip { background: rgba(255,255,255,.18); color: #fff; }
.wallet-num { font-size: 19px; font-weight: 600; opacity: .95; }
.wallet-amount { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.wallet-amount strong { font-size: 52px; font-weight: 700; line-height: 1.05; }
.wallet-amount span { font-size: 18px; font-weight: 500; opacity: .9; }
.wallet-amount.none strong { font-size: 30px; font-weight: 600; }
.wallet-state { font-size: 14px; opacity: .92; }
.wallet-state.warn { display: inline-flex; gap: 6px; align-items: center; align-self: start; padding: 4px 10px; border-radius: 10px; background: rgba(255,255,255,.16); }
.wallet-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 4px; padding: 14px; background: #f7f6fe; }
.act { display: grid; justify-items: center; gap: 8px; padding: 12px 8px; border: 0; border-radius: var(--r-m); background: transparent; cursor: pointer; text-align: center; color: var(--iris-ink); font-weight: 600; }
.act:hover:not(:disabled) { background: #fff; }
.act .orb { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--cobalt), var(--plum)); }
.act .orb .ic { width: 22px; height: 22px; }
.act small { font-weight: 400; font-size: 12px; color: var(--muted); max-width: 18ch; }
.act:disabled { cursor: not-allowed; color: var(--muted); }
.act:disabled .orb { background: var(--line-strong); }

.pending-op { display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--r-m); background: var(--warn-bg); color: var(--warn); }
.pending-op h3 { color: var(--warn); }

/* ---------- tabs & tables ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 10px 16px; border: 0; background: none; border-bottom: 3px solid transparent; color: var(--ink-2); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected='true'] { color: var(--iris-ink); border-bottom-color: var(--iris); }
.panel { display: grid; gap: 14px; padding-top: 16px; }
.source { font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.seg button { padding: 6px 14px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.seg button[aria-pressed='true'] { background: var(--iris-wash); color: var(--iris-ink); }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; font-size: 14px; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px 14px; background: #faf9fe; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #faf9fe; }
.table tr.match td { background: var(--ok-bg); }
.amount-cell { font-weight: 600; white-space: nowrap; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; padding: 16px; border-radius: var(--r-m); background: var(--paper); }
dl.facts dt { color: var(--muted); font-size: 14px; }
dl.facts dd { margin: 0; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card { display: grid; gap: 12px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); align-content: start; }

/* ---------- dialogs ---------- */

dialog.sheet { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--r-l); background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(29,27,58,.28); }
dialog.sheet::backdrop { background: rgba(29,27,58,.45); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px 10px; }
.sheet-body { display: grid; gap: 16px; padding: 8px 22px 24px; }
.result { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 8px 0; }
.result .orb { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; }
.result .orb .ic { width: 28px; height: 28px; }
.result.ok .orb { background: var(--ok-bg); color: var(--ok); }
.result.bad .orb { background: var(--bad-bg); color: var(--bad); }
.result.warn .orb { background: var(--warn-bg); color: var(--warn); }
.captcha { max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; }

.toasts { position: fixed; inset-inline: 16px; bottom: 16px; display: grid; gap: 8px; justify-items: center; z-index: 60; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: 0 10px 30px rgba(29,27,58,.3); max-width: 520px; }
.toast.bad { background: var(--bad); }

.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .switch { order: 3; width: 100%; margin: 0; }
  .switch a { flex: 1; text-align: center; }
  .util a span { display: none; }
  .who { display: none; }
  .page { padding: 18px 16px 48px; gap: 18px; }
  h1 { font-size: 22px; }
  .wallet-top { padding: 20px 20px 24px; }
  .wallet-amount strong { font-size: 40px; }
  .wallet-actions { grid-template-columns: repeat(3, 1fr); padding: 10px 6px; }
  .act small { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table { border: 0; background: none; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 6px 14px; margin-bottom: 10px; }
  .table td { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; text-align: end; }
  .table td::before { content: attr(data-label); color: var(--muted); font-weight: 500; font-size: 13px; }
  .table tr td:last-child { border-bottom: 0; }
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: var(--r-l) var(--r-l) 0 0; }
  dl.facts { grid-template-columns: 1fr; gap: 2px; }
  dl.facts dd { margin-bottom: 8px; }
}

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