/* WosulPay portal — shell and page patterns. Tokens only; logical properties throughout. */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body { min-height: 100vh; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.mono { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.muted { color: var(--ink-muted); }
.strong { color: var(--ink-heading); font-weight: 700; }
.cur { font-size: 12px; font-weight: 500; color: var(--ink-muted); margin-inline-start: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.ico-xs { width: 14px; height: 14px; }
[dir="rtl"] .ico-flip { transform: scaleX(-1); }

/* Logo swaps: colour logo on light, white logo on dark */
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* ---------- Shell (Ecme) ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--line); }
.sidebar-inner { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-head { height: var(--header-height); display: flex; align-items: center; padding-inline: var(--space-6); flex: none; }
.sidebar-head img { height: 28px; width: auto; }
.sidebar nav { padding: var(--space-2) var(--space-4) var(--space-6); display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-muted); padding: var(--space-5) var(--space-4) var(--space-2); }
[lang="en"] .nav-group { text-transform: uppercase; letter-spacing: 0.04em; }
.sidebar-foot { padding: var(--space-4); border-top: 1px solid var(--line); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--header-height); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--space-3); padding-inline: var(--space-8); position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-md); border: 0; background: transparent; color: var(--ink-body); cursor: pointer; position: relative; font: inherit; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--surface-sunken); color: var(--ink-heading); }
.icon-btn .pip { position: absolute; top: 9px; inset-inline-end: 10px; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--primary); border: 2px solid var(--surface); }
.lang-btn { width: auto; padding-inline: var(--space-3); gap: var(--space-2); display: inline-flex; align-items: center; font-weight: 500; font-size: 14px; }
.theme-sun { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .theme-moon { display: none; }
.avatar { width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--primary-subtle); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar-lg { width: 44px; height: 44px; }
.avatar-ink { background: var(--accent-subtle); color: var(--accent); }

/* Business switcher */
.biz { position: relative; }
.biz-btn { display: flex; align-items: center; gap: var(--space-3); height: 44px; padding-inline: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--ink-heading); font: inherit; cursor: pointer; max-width: 360px; transition: border-color .15s; }
.biz-btn:hover { border-color: var(--line-strong); }
.biz-mono { width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--primary-subtle); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.biz-text { display: flex; flex-direction: column; text-align: start; min-width: 0; line-height: 18px; }
.biz-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.biz-id { font-size: 12px; color: var(--ink-muted); }
.popover { position: absolute; top: calc(100% + var(--space-2)); inset-inline-start: 0; width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--space-2); display: none; z-index: 30; }
.popover.open { display: block; }
.pop-label { font-size: 12px; font-weight: 700; color: var(--ink-muted); padding: var(--space-2) var(--space-3); }
.pop-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); color: var(--ink-heading); cursor: pointer; }
.pop-item:hover, .pop-item.is-active { background: var(--surface-sunken); }
.pop-item .grow { flex: 1; min-width: 0; }
.pop-sep { height: 1px; background: var(--line); margin: var(--space-2) 0; }
.pop-note { font-size: 12px; line-height: 20px; color: var(--ink-muted); padding: var(--space-2) var(--space-3); }

/* ---------- Page ---------- */
.page { padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-6); max-width: 1440px; width: 100%; }
.page-narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: var(--space-2); max-width: 720px; }
.eyebrow { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--primary); }
[lang="en"] .eyebrow { text-transform: uppercase; letter-spacing: 0.04em; }
.page-title { font-size: 30px; line-height: 40px; font-weight: 700; color: var(--ink-heading); }
.page-lead { font-size: 16px; line-height: 28px; color: var(--ink-body); }
.section-title { font-size: 20px; line-height: 30px; font-weight: 700; color: var(--ink-heading); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.head-actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: var(--space-4); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-side-main { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-2 { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.card-sub { font-size: 14px; color: var(--ink-muted); margin-top: var(--space-1); }
.wp-card-head > div { min-width: 0; }
.card-flush .wp-card-body { padding: 0 var(--space-6) var(--space-4); }

/* Notice banners */
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--info-subtle); color: var(--ink-body); }
.notice .ico { color: var(--info); margin-top: 2px; }
.notice-success { background: var(--success-subtle); } .notice-success .ico { color: var(--success); }
.notice-danger { background: var(--danger-subtle); } .notice-danger .ico { color: var(--danger); }
.notice-warning { background: var(--warning-subtle); } .notice-warning .ico { color: var(--warning); }
.notice-neutral { background: var(--surface-sunken); } .notice-neutral .ico { color: var(--ink-muted); }
.notice strong { color: var(--ink-heading); display: block; }

/* Balance hero — the black ink of the mark */
.balance { background: var(--accent); color: var(--on-accent); border-radius: var(--radius-xl); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); position: relative; overflow: hidden; }
.balance .label { font-size: 14px; font-weight: 500; opacity: .72; }
.balance .value { font-size: 40px; line-height: 52px; font-weight: 800; font-variant-numeric: tabular-nums; }
.balance .value .cur { color: inherit; opacity: .64; font-size: 18px; }
.balance .split { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid color-mix(in srgb, var(--on-accent) 18%, transparent); }
.balance .split div { display: flex; flex-direction: column; gap: 2px; }
.balance .split .k { font-size: 12px; opacity: .72; }
.balance .split .v { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.balance .split .n { font-size: 12px; opacity: .64; }
.balance .eye { position: absolute; top: var(--space-5); inset-inline-end: var(--space-5); color: inherit; }
.balance .eye:hover { background: color-mix(in srgb, var(--on-accent) 12%, transparent); color: inherit; }
.balance .star { position: absolute; inset-inline-end: -28px; bottom: -36px; width: 180px; opacity: .08; pointer-events: none; }
.balance.is-hidden [data-money] { filter: blur(8px); }

/* Action tiles */
.tile { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink-heading); font-weight: 700; transition: border-color .15s; }
.tile:hover { border-color: var(--primary); color: var(--ink-heading); }
.tile .well { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--primary-subtle); color: var(--primary); display: grid; place-items: center; flex: none; }
.tile .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tile .sub { font-weight: 400; font-size: 13px; line-height: 20px; color: var(--ink-muted); }
.tile .chev { color: var(--ink-muted); }
.well { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--primary-subtle); color: var(--primary); display: grid; place-items: center; flex: none; }
.well-ink { background: var(--accent-subtle); color: var(--accent); }
.well-info { background: var(--info-subtle); color: var(--info); }
.well-success { background: var(--success-subtle); color: var(--success); }
.well-sunken { background: var(--surface-sunken); color: var(--ink-body); }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-item .title { color: var(--ink-heading); font-weight: 700; }
.list-item .meta { font-size: 12px; line-height: 20px; color: var(--ink-muted); }
.amt { font-weight: 700; color: var(--ink-heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt-in { color: var(--success); }

/* Key-value */
.kv { display: grid; gap: var(--space-4); }
.kv-item { display: flex; flex-direction: column; gap: 2px; }
.kv-k { font-size: 12px; line-height: 20px; color: var(--ink-muted); font-weight: 500; }
.kv-v { color: var(--ink-heading); font-weight: 700; font-size: 15px; }
.kv-row { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.panel { background: var(--surface-sunken); border-radius: var(--radius-md); padding: var(--space-4); }

/* Steps (Fund → Move → Settle) */
.steps { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: var(--space-4); align-items: start; }
.step { display: flex; gap: var(--space-3); }
.step h4 { font-size: 16px; line-height: 26px; color: var(--ink-heading); }
.step p { color: var(--ink-body); font-size: 14px; }
.steps .arrow { color: var(--ink-muted); margin-top: 12px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: var(--space-5); }
.select { appearance: none; height: var(--control-md); padding-inline: var(--space-3) var(--space-8); background: var(--surface-sunken) no-repeat; border: 1px solid var(--surface-sunken); border-radius: var(--radius-md); font: inherit; font-size: 14px; font-weight: 500; color: var(--ink-heading); cursor: pointer; width: 100%; }
.select-wrap { position: relative; }
.select-wrap .ico { position: absolute; inset-inline-end: var(--space-3); top: 50%; margin-top: -8px; color: var(--ink-muted); pointer-events: none; }
.select:hover { border-color: var(--line-strong); }
.select:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-4); align-items: end; }
.filters .wide { grid-column: span 2; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.wp-input input[type="date"] { color-scheme: inherit; }

/* Choice cards (language/theme) */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--space-3); }
.choice { display: flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-md); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink-heading); font: inherit; font-weight: 500; cursor: pointer; }
.choice.is-active { border-color: var(--primary); background: var(--primary-subtle); color: var(--primary); font-weight: 700; box-shadow: 0 0 0 1px var(--primary); }

/* Table extras */
.wp-table th.end, .wp-table td.end { text-align: end; }
.wp-table th { text-align: start; }
.cell-2 { display: flex; flex-direction: column; line-height: 20px; }
.cell-2 .meta { font-size: 12px; color: var(--ink-muted); }
.cell-2 > .wp-badge, .stack-2 > .wp-badge { align-self: flex-start; }
.wrap-note { white-space: normal; max-width: 200px; }
.person { display: flex; align-items: center; gap: var(--space-3); }
.copy { display: inline-flex; align-items: center; gap: var(--space-1); border: 0; background: transparent; color: var(--ink-muted); cursor: pointer; padding: 2px 4px; border-radius: var(--radius-sm); font: inherit; font-size: 12px; }
.copy:hover { color: var(--primary); background: var(--primary-subtle); }
.mini-bar { width: 96px; height: 6px; border-radius: var(--radius-full); background: var(--surface-sunken); overflow: hidden; margin-top: 4px; }
.mini-bar span { display: block; height: 100%; background: var(--success); border-radius: var(--radius-full); }
.pill-count { display: inline-flex; align-items: center; height: 28px; padding-inline: var(--space-3); border-radius: var(--radius-full); background: var(--surface-sunken); color: var(--ink-body); font-size: 12px; font-weight: 700; }
.summary-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }

/* Chart */
.chart { width: 100%; height: 220px; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-muted); font-size: 11px; font-family: var(--font-sans); }
.chart .s1 { fill: var(--chart-1); }
.chart .s4 { fill: var(--chart-4); }
.legend { display: flex; gap: var(--space-4); font-size: 12px; color: var(--ink-muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Help */
.support-num { font-size: 24px; line-height: 34px; font-weight: 800; color: var(--ink-heading); direction: ltr; unicode-bidi: isolate; }

/* Gallery index */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4); }
.gallery a { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink-heading); font-weight: 700; transition: border-color .15s; }
.gallery a:hover { border-color: var(--primary); color: var(--ink-heading); }
.gallery small { font-weight: 400; color: var(--ink-muted); font-size: 13px; }

/* Responsive */
.scrim { display: none; }
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main-side, .g-side-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; overflow-y: auto; inset-inline-start: 0; width: var(--sidebar-width); z-index: 50; transform: translateX(-100%); transition: transform .2s ease-out; box-shadow: var(--shadow-lg); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
  .menu-btn { display: inline-grid; }
  .steps { grid-template-columns: 1fr; }
  .steps .arrow { display: none; }
  .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .page { padding: var(--space-6); }
  .topbar { padding-inline: var(--space-4); }
  .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .biz { flex: 1; min-width: 0; }
  .biz-btn { width: 100%; min-width: 0; }
  .biz-name { max-width: none; }
  .topbar > .wp-badge, .topbar > .avatar { display: none; }
  .topbar .spacer { display: none; }
  .popover { width: min(340px, calc(100vw - 32px)); }
  .lang-btn span { display: none; }
  .balance .split { grid-template-columns: 1fr; }
  .filters .wide { grid-column: auto; }
  .page-title { font-size: 24px; line-height: 34px; }
}
