/* WunaPay dashboard — one stylesheet for the whole signed-in app.
   Forest sidebar, quiet neutral workspace, terracotta only for the main action, gold for test mode. */

:root {
  --forest: #1F4A3C; --forest-deep: #143429; --forest-ink: #0D241C;
  --terra: #B2432A; --terra-hover: #9A3822; --terra-soft: #F6E4DF;
  --terra-btn: #B2432A; --terra-btn-hover: #9A3822;   /* background of main buttons (white text on it: 5.6:1) */
  --gold: #E9B44C; --gold-soft: #FBF1DC; --gold-ink: #6B4E0E;
  --bg: #F5F4F0; --surface: #FFFFFF; --surface-2: #FAF9F6; --sunken: #EFEDE7;
  --ink: #16201C; --ink-2: #3B4742; --muted: #66726D; --faint: #646E68;   /* faint: 4.8:1 on --bg */
  --line: #E4E1D9; --line-strong: #D3CFC4;
  --ok: #1E7A4E; --ok-soft: #E1F2E8; --bad: #B4231B; --bad-soft: #FBE5E2; --warn: #9A6200; --warn-soft: #FCF0D6;
  --info: #22577A; --info-soft: #E2EEF6; --neutral-soft: #ECEAE4;
  --mtn: #F2C200; --orange: #F26B1D;
  --focus: 0 0 0 3px rgba(178, 67, 42, .28);
  --shadow: 0 1px 2px rgba(22, 32, 28, .06), 0 1px 1px rgba(22, 32, 28, .03);
  --shadow-pop: 0 12px 32px rgba(13, 36, 28, .16), 0 2px 6px rgba(13, 36, 28, .08);
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 252px; --top-h: 60px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --forest: #173A2F; --forest-deep: #0E2820; --forest-ink: #081A14;
  /* Dark: terra as text is lighter (5.2:1 on cards); main buttons use a darker terra so white text reads 4.97:1 */
  --terra: #E07254; --terra-hover: #EA8468; --terra-soft: #3A211A;
  --terra-btn: #B8502F; --terra-btn-hover: #A9472A;
  --gold: #E9B44C; --gold-soft: #2E2612; --gold-ink: #F0CB7C;
  --bg: #0E1412; --surface: #151D1A; --surface-2: #19221F; --sunken: #0B100E;
  --ink: #E8EEEB; --ink-2: #C3CDC8; --muted: #93A19A; --faint: #8A968F;   /* faint: 5.6:1 on cards */
  --line: #26312D; --line-strong: #34413C;
  --ok: #4FC488; --ok-soft: #12291D; --bad: #F0776D; --bad-soft: #301715; --warn: #E8B24E; --warn-soft: #2D2410;
  --info: #79B5DB; --info-soft: #14242F; --neutral-soft: #222B28;
  --focus: 0 0 0 3px rgba(210, 96, 63, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; }
p { margin: 0; }
svg { flex-shrink: 0; }
h1:focus, h1:focus-visible { outline: none; box-shadow: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
/* visually hidden, still read by screen readers (!important: layout rules like ".wl > *" must not make it visible) */
.sr { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden, [hidden] { display: none !important; }

/* ================= Layout ================= */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--forest); color: #DCE8E2; display: flex; flex-direction: column; z-index: 40; }
.side-head { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -0.03em; }
.brand-dot { color: var(--gold); }
.biz { margin: 14px 12px 6px; padding: 10px 12px; border-radius: var(--r); background: rgba(255,255,255,.06); display: flex; align-items: center; gap: 10px;
  border: 0; width: calc(100% - 24px); text-align: left; cursor: default; color: inherit; }
.biz-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--gold); color: var(--forest-ink); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; overflow: hidden; flex-shrink: 0; }
.biz-logo img { width: 100%; height: 100%; object-fit: cover; }
.biz-name { font-weight: 600; color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-role { font-size: 12px; color: #9DB9AC; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-group { margin-top: 14px; }
.nav-label { padding: 0 10px 6px; font-size: 11.5px; font-weight: 600; color: #86A597; letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px; color: #CFE0D8; text-decoration: none; font-weight: 500;
  font-size: 13.5px; position: relative; }
.nav a svg { width: 17px; height: 17px; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(255,255,255,.11); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav .count { margin-left: auto; background: var(--gold); color: var(--forest-ink); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; gap: 4px; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; background: none; border: 0;
  color: #A9C2B6; text-decoration: none; font-size: 13px; cursor: pointer; text-align: left; }
.side-foot a:hover, .side-foot button:hover { background: rgba(255,255,255,.06); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top-h); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 24px; }
.top .menu-btn { display: none; }
.search-btn { flex: 0 1 420px; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px 0 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; text-align: left; }
.search-btn span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-btn:hover { border-color: var(--line-strong); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }
.top-gap { flex: 1; }
.mode { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 99px; background: var(--sunken); border: 1px solid var(--line); }
.mode button { border: 0; background: none; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.mode button.on { background: var(--gold); color: #3A2A05; }
.mode button.on.live { background: var(--ok); color: var(--ok-soft); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.mode button[disabled] { cursor: not-allowed; opacity: .7; }
.icon-btn { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r); border: 1px solid transparent;
  background: none; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--terra-btn);
  color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 99px; background: var(--forest); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 99px; cursor: pointer; }
:root[data-theme="dark"] .avatar { background: #2C5A4A; }

.test-strip { background: var(--gold-soft); color: var(--gold-ink); border-bottom: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  font-size: 12.5px; padding: 6px 24px; display: flex; gap: 8px; align-items: center; }
.test-strip b { font-weight: 600; }
.test-strip a { color: inherit; font-weight: 600; }

.view { padding: 28px 32px 64px; max-width: 1240px; width: 100%; margin: 0 auto; }
.view.wide { max-width: 1440px; }

/* ================= Page header ================= */
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.ph-text { flex: 1 1 320px; min-width: 0; }
.ph h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.025em; }
.ph p { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.crumb:hover { color: var(--ink); }

/* ================= Buttons ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 550; font-size: 13.5px; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--terra-btn); border-color: var(--terra-btn); color: #fff; }
.btn-primary:hover { background: var(--terra-btn-hover); border-color: var(--terra-btn-hover); }
.btn-dark { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn-dark:hover { background: var(--forest-deep); }
.btn-ghost { border-color: transparent; background: none; }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.link { color: var(--terra); text-decoration: none; font-weight: 550; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ================= Cards & grids ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2 { font-size: 15px; font-weight: 620; flex: 1; }
.card-h .sub { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.card-b { padding: 20px; }
.card-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; } .mt-l { margin-top: 24px; }

/* KPI tiles */
.kpi { padding: 18px 20px; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; margin-top: 6px; white-space: nowrap; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-foot { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 99px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--neutral-soft); }

/* The balance tile on Home gets the forest treatment: the one bold thing on the page. */
.hero-balance { background: var(--forest); color: #fff; border-color: var(--forest); position: relative; overflow: hidden; }
.hero-balance .kpi-label { color: #A9C7BA; }
.hero-balance .kpi-value { font-size: 34px; }
.hero-balance .kpi-value small { color: #A9C7BA; }
.hero-balance .kpi-foot { color: #C4D8CF; }
.hero-balance .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.hero-balance .btn:hover { background: rgba(255,255,255,.18); }
.hero-balance .btn-primary { background: var(--gold); border-color: var(--gold); color: #2B2006; }
.hero-balance .btn-primary:hover { background: #F0C366; }
.hero-balance::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 36px solid rgba(233, 180, 76, .10); pointer-events: none; }

/* ================= Tables ================= */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12.5px; padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--surface-2); }
.t .r { text-align: right; }
.t .amt { font-weight: 600; text-align: right; white-space: nowrap; }
.t .sub { color: var(--muted); font-size: 12.5px; }
.t .clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t td.actions { text-align: right; white-space: nowrap; }
.t td.actions .btn + .btn { margin-left: 6px; }
.t th:first-child, .t td:first-child { padding-left: 20px; }
.t th:last-child, .t td:last-child { padding-right: 20px; }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager .spacer { flex: 1; }

/* ================= Badges ================= */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--neutral-soft); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); }
.method { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.method i { min-width: 22px; height: 18px; padding: 0 3px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: -0.02em; }
.method i.mtn { background: var(--mtn); color: #1B1B1B; }
.method i.orange { background: var(--orange); color: #1B1B1B; }
.method i.wal { background: var(--forest); color: var(--gold); }

/* ================= Filters ================= */
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.filters .input, .filters select.input { height: 34px; font-size: 13px; }
.filters .search { flex: 1 1 220px; position: relative; }
.filters .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 15px; height: 15px; }
.filters .search .input { padding-left: 32px; width: 100%; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a { border: 0; background: none; padding: 12px 10px 10px; font-weight: 550; color: var(--muted); cursor: pointer; text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; }
.tabs .on { color: var(--ink); border-bottom-color: var(--terra); }
.tabs .count { background: var(--sunken); color: var(--ink-2); font-size: 11px; padding: 0 6px; border-radius: 99px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--sunken); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 4px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ================= Forms ================= */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 550; font-size: 13px; color: var(--ink-2); }
.field .hint { color: var(--muted); font-size: 12.5px; }
.field .err { color: var(--bad); font-size: 12.5px; }
.input { height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); width: 100%; min-width: 0; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366726D' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.input:focus { outline: none; border-color: var(--terra); box-shadow: var(--focus); }
.input[readonly] { background: var(--surface-2); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 8px 0 0 8px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 8px 8px 0;
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 550; }
.input-group .btn { border-radius: 0 8px 8px 0; border-left: 0; height: 38px; }
.form { display: grid; gap: 16px; }
.form.two { grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--terra); }
.check b { display: block; font-weight: 550; }
.check span { color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }
.choice { display: grid; gap: 10px; }
.choice label { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; align-items: flex-start; }
.choice label:has(input:checked) { border-color: var(--terra); background: var(--terra-soft); }
.choice input { accent-color: var(--terra); margin-top: 3px; }
.choice b { display: block; font-weight: 600; }
.choice span { color: var(--muted); font-size: 13px; }
.form-error { padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-weight: 500; font-size: 13px; }
.setting-row { display: flex; gap: 16px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; }
.setting-row .txt { flex: 1; min-width: 0; }
.setting-row .txt b { display: block; font-weight: 550; }
.setting-row .txt span { color: var(--muted); font-size: 13px; }

/* ================= Key/value lists ================= */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 0; }
.kv dt, .kv dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv dt:first-of-type, .kv dd:first-of-type { border-top: 0; }
.copy-line { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; max-width: 100%; box-sizing: border-box; }
.copy-line code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.code { margin: 0; padding: 14px 16px; border-radius: var(--r); background: #0F1A16; color: #D9E6E0; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.6; overflow: auto; max-height: 420px; }

/* ================= Empty, notices, skeleton ================= */
.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--sunken); color: var(--muted); display: grid; place-items: center; margin-bottom: 6px; }
.empty h3 { font-size: 15px; font-weight: 600; }
.empty p { color: var(--muted); max-width: 46ch; }
.empty .btn { margin-top: 10px; }
.notice { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); align-items: flex-start; }
.notice svg { margin-top: 1px; width: 18px; height: 18px; }
.notice .txt { flex: 1; min-width: 0; }
.notice b { font-weight: 600; }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.notice.warn .txt { color: var(--ink); }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.notice.bad svg { color: var(--bad); }
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice.ok svg { color: var(--ok); }
.notice.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.notice.info svg { color: var(--info); }
.sk { background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }
.loading { padding: 60px; display: grid; place-items: center; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--terra); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= Checklist & quick actions ================= */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li a { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); text-decoration: none; }
.checklist li:first-child a { border-top: 0; }
.checklist li a:hover { background: var(--surface-2); }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex-shrink: 0; }
.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.done .ck-text { color: var(--muted); text-decoration: line-through; }
.progress { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick button, .quick a { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; text-align: left; text-decoration: none; font-weight: 550; box-shadow: var(--shadow); }
.quick button:hover, .quick a:hover { border-color: var(--line-strong); background: var(--surface-2); }
.quick .qi { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--terra-soft); color: var(--terra); }
.quick small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; margin-top: 2px; }

/* ================= Charts ================= */
.chart { width: 100%; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .area { fill: url(#gArea); }
.chart .line { fill: none; stroke: var(--terra); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.prev { stroke: var(--faint); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .bar { fill: var(--forest); }
:root[data-theme="dark"] .chart .bar { fill: #3E8A6E; }
.chart .bar.alt { fill: var(--terra); }
.chart .hover-line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--surface); stroke: var(--terra); stroke-width: 2; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap;
  transform: translate(-50%, -110%); box-shadow: var(--shadow-pop); }
.chart-tip b { display: block; font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.hbar { display: grid; grid-template-columns: minmax(124px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 99px; background: var(--forest); }
:root[data-theme="dark"] .hbar .track span { background: #3E8A6E; }
.hbar .track span.mtn { background: var(--mtn); }
.hbar .track span.orange { background: var(--orange); }
.hbar .track span.bad { background: var(--bad); }
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat div { aspect-ratio: 1; border-radius: 4px; background: var(--sunken); }
.split { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--sunken); }
.split span { display: block; height: 100%; }

/* ================= Overlays: modal, drawer, menus, palette, toast ================= */
.scrim { position: fixed; inset: 0; background: rgba(8, 20, 16, .45); z-index: 80; display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px; overflow-y: auto; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--line);
  animation: pop .14s ease-out; }
.modal.lg { max-width: 720px; }
.modal.sm { max-width: 420px; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.modal-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.modal-h h2 { font-size: 17px; font-weight: 640; flex: 1; }
.modal-h p { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg); flex-wrap: wrap; }
.drawer-scrim { justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slide .16s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer .modal-b { flex: 1; overflow-y: auto; }
.drawer .modal-f { border-radius: 0; }
.menu { position: fixed; z-index: 90; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop);
  padding: 6px; animation: pop .1s ease-out; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; border: 0; background: none; text-align: left;
  text-decoration: none; cursor: pointer; font-size: 13.5px; }
.menu a:hover, .menu button:hover, .menu .act { background: var(--sunken); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .menu-head b { display: block; }
.menu .menu-head span { color: var(--muted); font-size: 12.5px; }
.notif-panel { width: min(400px, calc(100vw - 24px)); padding: 0; }
.notif-head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-head b { flex: 1; }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; }
.notif:hover { background: var(--surface-2); }
.notif .n-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 6px; flex-shrink: 0; }
.notif.unread .n-dot { background: var(--terra); }
.notif .n-time { color: var(--faint); font-size: 12px; }
.palette { width: 100%; max-width: 600px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; border: 1px solid var(--line); }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-in input { flex: 1; height: 52px; border: 0; background: none; font-size: 15px; outline: none; }
.palette-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; color: var(--faint); font-size: 12px; font-weight: 550; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.palette-item.act { background: var(--sunken); }
.palette-item svg { color: var(--muted); width: 16px; height: 16px; }
.palette-item .hint { margin-left: auto; color: var(--faint); font-size: 12px; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); box-shadow: var(--shadow-pop); font-weight: 500; font-size: 13.5px;
  display: flex; gap: 8px; align-items: center; animation: pop .14s ease-out; max-width: 420px; }
.toast.bad { background: var(--bad); color: #fff; }

/* ================= Detail pages ================= */
.detail-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.detail-amount { font-size: 32px; font-weight: 650; letter-spacing: -0.03em; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line-strong); margin-top: 4px; flex-shrink: 0; z-index: 1; }
.timeline .tl-dot.ok { background: var(--ok); } .timeline .tl-dot.bad { background: var(--bad); } .timeline .tl-dot.info { background: var(--info); }
.timeline small { display: block; color: var(--muted); font-size: 12px; }

/* Invoice editor & preview */
.items-table .input { height: 34px; }
.items-table td { padding: 6px 8px; }
.items-table th { padding: 8px; }
.totals { margin-left: auto; width: min(320px, 100%); }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 650; font-size: 16px; }
.paper { background: #fff; color: #16201C; border-radius: var(--r-lg); border: 1px solid var(--line); padding: 32px; }
.paper .muted { color: #66726D; }

/* Branding preview */
.pay-preview { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface-2); padding: 24px; display: grid; place-items: center; }
.pp-card { width: 100%; max-width: 320px; background: #fff; color: #16201C; border-radius: 14px; padding: 20px; box-shadow: var(--shadow-pop); }
.pp-btn { margin-top: 14px; height: 42px; display: grid; place-items: center; color: #fff; font-weight: 600; }

/* Settings hub */
.hub { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hub a { display: flex; gap: 12px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); text-decoration: none; box-shadow: var(--shadow); }
.hub a:hover { border-color: var(--line-strong); background: var(--surface-2); }
.hub .qi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); color: var(--forest); flex-shrink: 0; }
:root[data-theme="dark"] .hub .qi { color: #8BC9AE; }
.hub b { display: block; font-weight: 600; }
.hub span { color: var(--muted); font-size: 13px; }
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.subnav { position: sticky; top: calc(var(--top-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.subnav a { padding: 7px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 500; }
.subnav a:hover { color: var(--ink); background: var(--sunken); }
.subnav a.on { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); }

/* Statement print */
.statement-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }


/* Verification wizard */
.kyc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.kyc-steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.kyc-steps button { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 8px; border-radius: 8px; border: 0; background: none; text-align: left; cursor: pointer; }
.kyc-steps button:hover { background: var(--sunken); }
.kyc-steps button.on { background: var(--terra-soft); }
.kyc-steps .n { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 11px; font-weight: 650; flex-shrink: 0; color: var(--muted); }
.kyc-steps .done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.kyc-steps .on .n { border-color: var(--terra); color: var(--terra); }
.kyc-steps b { display: block; font-weight: 600; font-size: 13px; }
.kyc-steps small { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .kyc-layout { grid-template-columns: 1fr; } }

/* ================= Go live ================= */
.gl-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.gl-step { display: flex; gap: 12px; align-items: flex-start; }
.gl-step > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gl-step .muted { font-size: 13px; }
.gl-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 13px; font-weight: 650;
  border: 1.5px solid var(--line-strong); color: var(--muted); }
.gl-step.now .gl-n { border-color: var(--terra); color: var(--terra); }
.gl-step.done .gl-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; cursor: pointer; }
.check-row input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--terra); flex-shrink: 0; }
.badge.test { background: var(--gold-soft); color: var(--gold-ink); }
@media (max-width: 900px) { .gl-grid { grid-template-columns: minmax(0, 1fr); } }

.neg { color: var(--bad); }
.how-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.5; }
.recon-cell { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-decoration: none; color: inherit; }
.recon-cell:hover .badge { outline: 1px solid var(--line-strong); }

/* ================= Responsive ================= */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  /* closed: off screen AND hidden, so Tab and screen readers skip its links (visibility waits for the slide to end) */
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(var(--side-w), 84vw); transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  .app.nav-open .side { transform: none; visibility: visible; box-shadow: var(--shadow-pop); transition: transform .2s ease; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8,20,16,.45); z-index: 35; }
  .top .menu-btn { display: grid; }
  .top { padding: 0 12px; }
  .search-btn kbd { display: none; }
  .view { padding: 20px 16px 48px; }
  .test-strip { padding: 6px 16px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: 1fr; }
  .subnav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .subnav a { white-space: nowrap; }
}
@media (max-width: 600px) {
  .g4, .quick, .hub { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form.two { grid-template-columns: 1fr; }
  .mode .lbl-live { display: none; }
  .mode.both .lbl-live { display: inline-flex; }
  .search-btn { flex: 1 1 auto; }
  .search-btn span { display: none; }
  .search-btn { flex: 0 0 36px; width: 36px; padding: 0; justify-content: center; }
  .ph h1 { font-size: 21px; }
  .kpi-value { font-size: 22px; }
  .hero-balance .kpi-value { font-size: 28px; }
  .t .hide-sm { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { padding-bottom: 0; } .kv dd { border-top: 0; padding-top: 2px; }
  .paper { padding: 20px; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .side, .top, .test-strip, .no-print, .toasts { display: none !important; }
  .app { display: block; } body { background: #fff; color: #000; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
}
.palette-in input:focus, .palette-in input:focus-visible { box-shadow: none; }
.paper .t th { background: #F5F4F0; color: #66726D; border-color: #E4E1D9; }
.paper .t td { border-color: #E4E1D9; color: #16201C; }
.nav a { padding: 6px 10px; }
.nav-group { margin-top: 12px; }
.test-strip.ctl-bad { background: var(--bad-soft); color: var(--bad); border-bottom-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.test-strip.ctl-warn { background: var(--warn-soft); color: var(--warn); }
.test-strip.ctl-bad span, .test-strip.ctl-warn span { color: var(--ink); }
.nav a { padding: 5px 10px; font-size: 13px; }
.nav-group { margin-top: 10px; }
.nav-label { padding-bottom: 4px; }
.biz { margin: 10px 12px 2px; padding: 8px 10px; }

/* Business verification papers in the admin wallet page */
.vdocs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.vdoc { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); font-size: 13px; }
.vdoc img, .vdoc-pdf { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.vdoc-pdf { display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.vdoc:hover img { outline: 2px solid var(--brand, currentColor); }

/* Admin "Stuck money": row buttons wrap on small screens */
.stuck-actions { justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
@media (max-width: 640px) { .stuck-actions { justify-content: flex-start; } }

/* 0.9.13 accessibility */
/* Long texts in tables (SMS, emails, notes): cut to one line, open in full on click */
.t .sub.clip[role=button] { cursor: pointer; }
.t .sub.clip[role=button]:hover { color: var(--ink-2); }
.t .sub.clip.expanded { white-space: pre-wrap; overflow: visible; overflow-wrap: anywhere; max-width: 520px !important; }
/* Phones: buttons and switches big enough for a thumb (40 px or more) */
@media (max-width: 600px) {
  .btn, .btn-sm, .input-group .btn { min-height: 40px; }
  .btn-sm { padding: 0 12px; }
  .btn-sm.btn-icon, .btn-icon { min-width: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .mode button { min-height: 40px; padding: 6px 12px; }
  .mode { padding: 2px; }
  .seg button { min-height: 40px; padding: 6px 12px; }
  .tabs button, .tabs a { min-height: 44px; }
  .switch { width: 44px; height: 26px; }
  .switch span::after { width: 22px; height: 22px; }
  .switch input:checked + span::after { transform: translateX(18px); }
  .filters .input, .filters select.input { height: 40px; }
  .menu a, .menu button { min-height: 40px; }
  .side-foot a, .side-foot button, .nav a { min-height: 40px; }
  .t .sub.clip[role=button] { padding: 6px 0; }
}
