@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans+Condensed:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  color-scheme: light;
  --paper: #f3f6f5;
  --surface: #ffffff;
  --sunk: #eaf0ee;
  --ink: #142230;
  --muted: #56656f;
  --line: #d8e0e2;
  /* Lupi green: #00BF63 is the logo; #007A42 keeps AA contrast for white text and links. */
  --brand: #007a42;
  --brand-ink: #ffffff;
  --brand-soft: #e3f6ec;
  --brand-dot: #00bf63;
  --uk: #27519a;
  --uk-soft: #e4ebf8;
  --ng: #17774a;
  --ng-soft: #e0f2e7;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a10;
  --warn-soft: #fbf0dc;
  --shadow: 0 1px 2px rgba(20, 34, 48, 0.06), 0 4px 16px rgba(20, 34, 48, 0.05);
}
/* Dark theme: follows the device unless the viewer picked Light or Dark (html[data-theme]). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e161c;
    --surface: #152029;
    --sunk: #111b22;
    --ink: #e4ebee;
    --muted: #97a7b1;
    --line: #26343f;
    --brand: #00bf63;
    --brand-ink: #03140b;
    --brand-soft: #0f3324;
    --brand-dot: #00bf63;
    --uk: #8fb0ee;
    --uk-soft: #1a2a45;
    --ng: #6fd39f;
    --ng-soft: #163a28;
    --danger: #ff8a7f;
    --danger-soft: #3d1a17;
    --warn: #f0b566;
    --warn-soft: #3a2a14;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e161c;
  --surface: #152029;
  --sunk: #111b22;
  --ink: #e4ebee;
  --muted: #97a7b1;
  --line: #26343f;
  --brand: #00bf63;
  --brand-ink: #03140b;
  --brand-soft: #0f3324;
  --brand-dot: #00bf63;
  --uk: #8fb0ee;
  --uk-soft: #1a2a45;
  --ng: #6fd39f;
  --ng-soft: #163a28;
  --danger: #ff8a7f;
  --danger-soft: #3d1a17;
  --warn: #f0b566;
  --warn-soft: #3a2a14;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  min-height: 100vh;
}
h1, h2, h3 { font-family: 'IBM Plex Sans Condensed', 'Arial Narrow', sans-serif; line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--brand); }
code, .mono { font-family: 'IBM Plex Mono', ui-monospace, Menlo, monospace; font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- structure ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand .lupi-logo { height: 28px; color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.brand .area { font-family: 'IBM Plex Sans Condensed', sans-serif; font-weight: 600; color: var(--muted); font-size: 15px; padding-left: 12px; border-left: 1px solid var(--line); }
@media (max-width: 480px) { .brand .area { display: none; } }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.page { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; display: grid; gap: 24px; }
.narrow { max-width: 760px; }
.split { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
@media (max-width: 820px) { .split { grid-template-columns: minmax(0, 1fr); } }
.sidenav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 72px; align-self: start; }
@media (max-width: 820px) { .sidenav { position: static; flex-direction: row; flex-wrap: wrap; } }
.sidenav button { text-align: left; background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; font: inherit; cursor: pointer; }
.sidenav button:hover { color: var(--ink); background: var(--sunk); }
.sidenav button[aria-current='page'] { color: var(--ink); background: var(--brand-soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-dot); }
.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.auth { max-width: 420px; margin: 56px auto; }
.auth .card { padding: 26px; display: grid; gap: 16px; }
.notice { border-radius: 10px; padding: 12px 14px; background: var(--brand-soft); font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--ink); }
.notice.danger { background: var(--danger-soft); }

/* ---------- forms ---------- */
label { display: grid; gap: 5px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; width: 100%;
}
textarea { font-family: 'IBM Plex Mono', monospace; font-size: 13px; min-height: 90px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn {
  font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; cursor: pointer;
  border: 1px solid transparent; background: var(--brand); color: var(--brand-ink);
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: none; color: var(--muted); border: 0; padding: 6px 8px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--sunk); }
.segmented button { border: 0; background: none; font: inherit; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- data ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--brand-soft); color: var(--brand); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.uk { background: var(--uk-soft); color: var(--uk); }
.pill.ng { background: var(--ng-soft); color: var(--ng); }
.amount { font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); background: var(--sunk); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
ul.grants { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.secret { display: grid; gap: 6px; }
.secret pre { margin: 0; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 12.5px/1.45 'IBM Plex Mono', monospace; white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow: auto; }
pre.code { margin: 0; background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: 13px/1.55 'IBM Plex Mono', monospace; overflow-x: auto; }
.empty { text-align: center; padding: 28px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- USSD phone ---------- */
.phone { width: 280px; max-width: 100%; border-radius: 28px; background: #1b2530; padding: 18px 14px 22px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.phone .screen { background: #cfe3c7; color: #102015; border-radius: 10px; min-height: 170px; padding: 12px; font: 14px/1.4 'IBM Plex Mono', monospace; white-space: pre-wrap; }
.phone input { background: #eef3ee; color: #102015; border: 0; font-family: 'IBM Plex Mono', monospace; }
.phone .keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); z-index: 20; }
#toast.error { background: var(--danger); color: #fff; }
@media (prefers-reduced-motion: no-preference) { #toast { transition: opacity 0.2s; } }
.grow { flex: 1; min-width: 180px; }
.align-end { align-self: end; }
.align-start { align-items: flex-start; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .bar { fill: var(--brand); }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: 'IBM Plex Sans', sans-serif; }

/* ---------- sign-in & account security ---------- */
.stack.tight { gap: 6px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkish:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.input-with-action { position: relative; display: flex; }
.input-with-action input { padding-right: 64px; }
.input-with-action .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.strength { height: 4px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.strength-bar { display: block; height: 100%; width: 0; background: var(--danger); }
.strength-bar.s1 { width: 25%; background: var(--danger); }
.strength-bar.s2 { width: 50%; background: var(--warn); }
.strength-bar.s3 { width: 75%; background: var(--brand-dot); }
.strength-bar.s4 { width: 100%; background: var(--brand-dot); }
@media (prefers-reduced-motion: no-preference) { .strength-bar { transition: width 0.2s, background 0.2s; } }
.code-input { font: 600 22px/1.2 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: 0.3em; text-align: center; padding: 10px; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 6px; }
.stepper li + li::before { content: ''; width: 18px; height: 1px; background: var(--line); }
.stepper .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 11px; font-weight: 600; }
.stepper li.current { color: var(--ink); font-weight: 600; }
.stepper li.current .n { border-color: var(--brand); color: var(--brand); }
.stepper li.done .n { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.howto { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.qr-wrap { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 440px) { .qr-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; } }
.qr { display: block; width: 176px; height: 176px; border-radius: 10px; background: #fff; padding: 6px; border: 1px solid var(--line); }
.setup-key { font-size: 14px; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.recovery-codes { list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; font-size: 14.5px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
label.check input { width: auto; }

/* ---------- test customer authenticator code ---------- */
.totp-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--sunk); }
.totp-code { font-size: 26px; font-weight: 600; letter-spacing: 0.12em; color: var(--ink); }
.totp-track { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.totp-bar { display: block; height: 100%; width: 100%; background: var(--brand-dot); transform-origin: left; }
.totp-bar.ending { background: var(--warn); }
.totp-bar[data-left="0"] { transform: scaleX(0.000); }
.totp-bar[data-left="1"] { transform: scaleX(0.033); }
.totp-bar[data-left="2"] { transform: scaleX(0.067); }
.totp-bar[data-left="3"] { transform: scaleX(0.100); }
.totp-bar[data-left="4"] { transform: scaleX(0.133); }
.totp-bar[data-left="5"] { transform: scaleX(0.167); }
.totp-bar[data-left="6"] { transform: scaleX(0.200); }
.totp-bar[data-left="7"] { transform: scaleX(0.233); }
.totp-bar[data-left="8"] { transform: scaleX(0.267); }
.totp-bar[data-left="9"] { transform: scaleX(0.300); }
.totp-bar[data-left="10"] { transform: scaleX(0.333); }
.totp-bar[data-left="11"] { transform: scaleX(0.367); }
.totp-bar[data-left="12"] { transform: scaleX(0.400); }
.totp-bar[data-left="13"] { transform: scaleX(0.433); }
.totp-bar[data-left="14"] { transform: scaleX(0.467); }
.totp-bar[data-left="15"] { transform: scaleX(0.500); }
.totp-bar[data-left="16"] { transform: scaleX(0.533); }
.totp-bar[data-left="17"] { transform: scaleX(0.567); }
.totp-bar[data-left="18"] { transform: scaleX(0.600); }
.totp-bar[data-left="19"] { transform: scaleX(0.633); }
.totp-bar[data-left="20"] { transform: scaleX(0.667); }
.totp-bar[data-left="21"] { transform: scaleX(0.700); }
.totp-bar[data-left="22"] { transform: scaleX(0.733); }
.totp-bar[data-left="23"] { transform: scaleX(0.767); }
.totp-bar[data-left="24"] { transform: scaleX(0.800); }
.totp-bar[data-left="25"] { transform: scaleX(0.833); }
.totp-bar[data-left="26"] { transform: scaleX(0.867); }
.totp-bar[data-left="27"] { transform: scaleX(0.900); }
.totp-bar[data-left="28"] { transform: scaleX(0.933); }
.totp-bar[data-left="29"] { transform: scaleX(0.967); }
.totp-bar[data-left="30"] { transform: scaleX(1.000); }
@media (prefers-reduced-motion: no-preference) { .totp-bar { transition: transform 1s linear, background 0.3s; } }
