/* MPOWR Remittance Sender — design tokens from brand guidelines ed. 2
   ink #08070B · paper #F6F5F8 · signal orange #FF7A1E · violet #8B5CF6
   Space Grotesk (display) · Inter (text) · JetBrains Mono (labels) */

:root {
  --orange: #FF7A1E;
  --orange-press: #E8650B;
  --violet: #8B5CF6;
  --violet-press: #7744EE;
  --green: #22C55E;
  --red: #F05252;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-text: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 14px;
  --radius-lg: 18px;
  --shell: 452px;
}

[data-theme='dark'] {
  --bg: #08070B;
  --surface: #17161B;
  --card: #0D0C10;
  --card-2: #1E1D23;
  --line: #2A2930;
  --line-strong: #4A4952;
  --text: #F6F5F8;
  --muted: #A3A1AB;
  --faint: #6E6C76;
  --warn: #FF8A3D;
  --focus: #FFB27A;
  color-scheme: dark;
}

[data-theme='light'] {
  --bg: #E9E7EE;
  --surface: #F6F5F8;
  --card: #FFFFFF;
  --card-2: #F0EEF4;
  --line: #E0DEE6;
  --line-strong: #B9B6C2;
  --text: #08070B;
  --muted: #5B5964;
  --faint: #8C8995;
  --warn: #C2500A;
  --focus: #FF7A1E;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-text);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--orange); color: #08070B; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  padding: 0 22px 40px;
  position: relative;
}
body.has-action-bar .shell { padding-bottom: 110px; }
#main { outline: none; }

.demo-banner {
  margin: 0 -22px;
  padding: 6px 22px;
  background: color-mix(in srgb, var(--violet) 18%, transparent);
  color: var(--text);
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: .04em;
  text-align: center;
}

/* ---- Header ---- */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 10px;
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
}
.logo img { width: 56px; height: auto; color: var(--text); }
[data-theme='light'] .logo img { filter: invert(1); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  min-width: 36px; height: 36px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font: 600 12px var(--font-text);
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn.small { min-width: 30px; height: 30px; padding: 0 6px; }
.home-btn.active { background: var(--orange); border-color: var(--orange); color: #08070B; }
.luz-pill {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--violet); color: #fff; display: inline-flex; align-items: center; gap: 6px; font-weight: 600;
}
.luz-pill:hover { background: var(--violet-press); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 44px; min-width: 210px; z-index: 30;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 500;
}
.menu-item:hover, .menu-item:focus-visible, .menu-item.active { background: var(--card-2); }

/* ---- Type ---- */
h1 { font: 700 30px/1.15 var(--font-display); letter-spacing: -.01em; margin: 6px 0 6px; }
h2 { font: 600 20px/1.2 var(--font-display); margin: 26px 0 12px; }
.eyebrow {
  font: 500 11px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); margin: 22px 0 10px;
}
.lede { color: var(--muted); margin: 0 0 16px; }
.meta { color: var(--faint); font-size: 12.5px; margin: 2px 0; }
.small { font-size: 13.5px; margin: 4px 0; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.center { text-align: center; }
.block { display: block; }
.big-number { font: 700 34px/1.1 var(--font-display); margin: 4px 0; letter-spacing: -.01em; }
.mid-number { font: 700 22px/1.2 var(--font-display); margin: 4px 0; }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.link.strong { font-weight: 600; }
.link.danger { color: var(--red); }
.link.small { font-size: 13px; }

.page { padding-top: 8px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } }

.back-link {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 0; margin: 0 0 4px;
  cursor: pointer; color: var(--muted); text-decoration: none; font-weight: 500;
}
.back-link:hover { color: var(--text); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--orange); color: #08070B; }
.btn-primary:not(:disabled):hover { background: var(--orange-press); }
.btn-luz { background: var(--violet); color: #fff; }
.btn-luz:hover { background: var(--violet-press); }
.btn-ghost { background: var(--card); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-outline { background: transparent; border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--text); }
.btn-dashed { background: transparent; border: 1px dashed var(--line-strong); height: 52px; border-radius: var(--radius); font-weight: 500; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-outline { background: transparent; border-color: var(--red); color: var(--red); }
.btn-whatsapp { background: #25D366; color: #08070B; }
.btn[aria-busy='true'] { position: relative; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; font-size: 13px; font-weight: 500;
}

/* ---- Home tiles ---- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 12px; }
.tile {
  height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
  cursor: pointer; font-weight: 600; text-align: left;
}
.tile:hover { border-color: var(--line-strong); }
.tile.active { border-color: var(--text); }

/* ---- Lists / rows ---- */
.list { display: flex; flex-direction: column; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }

.member-row, .recent-row, .bank-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
  text-align: left; cursor: pointer; text-decoration: none;
}
.member-row.static, .bank-row { cursor: default; }
.member-row:not(.static):hover, .recent-row:hover { border-color: var(--line-strong); }
.member-row.selected { border-color: var(--text); }
.recent-row { justify-content: space-between; }
.member-text { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.member-name { font-weight: 600; }
.member-sub { color: var(--muted); font-size: 12.5px; }
.member-warn { color: var(--warn); font-size: 12.5px; font-weight: 500; margin-top: 3px; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--orange); color: #08070B;
  display: inline-flex; align-items: center; justify-content: center; font: 600 13px var(--font-text);
}
.row-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font: 500 11px var(--font-mono); letter-spacing: .04em; text-transform: uppercase;
  background: var(--card-2); color: var(--muted); align-self: flex-start; white-space: nowrap;
}
.status-landed { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.status-processing { background: color-mix(in srgb, var(--violet) 22%, transparent); color: #B9A3FF; }
[data-theme='light'] .status-processing { color: var(--violet-press); }
.status-cancelled { background: var(--card-2); color: var(--muted); }
.status-failed { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.card > .eyebrow:first-child { margin-top: 2px; }
.card.muted { color: var(--muted); }
.card.dark { background: var(--card); }
.card.highlight { border-color: var(--text); }
.card + .card { margin-top: 12px; }
.alert-card { display: flex; gap: 12px; border-color: var(--orange); }
.alert-card p, .message-card p { margin: 2px 0; }
.message-card { display: flex; gap: 12px; }
.message-card .icon, .alert-card .icon { flex: none; margin-top: 2px; }
.lines .line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
.lines .line > span:first-child { color: var(--muted); }
.lines .line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.lines .line.total > span:first-child { color: var(--text); font-weight: 600; }
.card.highlight .line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.notice { padding: 12px 14px; border-radius: var(--radius); background: var(--card-2); margin: 12px 0; font-size: 14px; }
.notice.warn { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--text); }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }
.error-state { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* ---- Forms ---- */
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .select {
  height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); width: 100%; font-size: 16px;
}
.field input:focus, .field select:focus, .select:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 25%, transparent); }
.field.has-error input, .field.has-error select { border-color: var(--red); }
.field-error { color: var(--red); font-size: 12.5px; margin: 0; min-height: 0; }
.field-error:empty { display: none; }
.hint { color: var(--faint); font-size: 12.5px; margin: 0; }
.field.with-toggle input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 6px; top: 29px; width: 38px; height: 38px; border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; place-items: center; border-radius: 10px; }
.pw-toggle[aria-pressed='true'] { color: var(--orange); }
.field.check { flex-direction: row; align-items: flex-start; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
.field.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--orange); flex: none; }
.field.check label { flex: 1; color: var(--text); font-size: 13.5px; }
.field.check .field-error { flex-basis: 100%; }
.form-error { display: flex; gap: 8px; align-items: center; color: var(--red); font-size: 14px; }
.form-error:empty { display: none; }
.auth .stack { margin-top: 18px; }
.auth p.center { margin: 18px 0 0; }

/* ---- Send flow ---- */
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 2px 0 14px; }
.progress span { height: 3px; border-radius: 3px; background: var(--line); }
.progress span.on { background: var(--orange); }
.amount-wrap { position: relative; margin: 6px 0 4px; }
.amount-prefix { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--faint); font: 600 22px var(--font-display); }
.amount-input {
  width: 100%; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  text-align: center; font: 600 24px var(--font-display); padding: 0 40px;
}
.amount-input:focus { outline: none; border-color: var(--orange); }
.receive-block { margin-top: 26px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-top: 8px; }
.stepper-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--card-2); cursor: pointer; display: grid; place-items: center; }
.stepper-btn:disabled { opacity: .35; cursor: not-allowed; }
.stepper-value { font-weight: 600; font-size: 14px; text-align: center; }
.bill-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); cursor: pointer;
}
.bill-row > span:first-child { display: flex; flex-direction: column; }
.bill-amt { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.bill-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-ui { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; color: transparent; }
.bill-row input:checked + .check-ui { background: var(--orange); border-color: var(--orange); color: #08070B; }
.bill-row:has(input:checked) { border-color: var(--text); }
.bill-row:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.done-page { padding-top: 24px; }
.done-icon { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 50%; background: var(--orange); color: #08070B; display: grid; place-items: center; }
.done-page .pill { align-self: center; margin-top: 10px; }

.action-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--shell); padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); z-index: 15;
}
.action-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.action-row .btn { width: 100%; padding: 0 14px; }

/* ---- Recipients / tabs ---- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tab { height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; font-weight: 600; text-align: left; padding: 0 14px; }
.tab.active { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.edit-card { border-color: var(--text); }

/* ---- Settings ---- */
.kv { padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv p { margin: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.seg { height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; font-weight: 600; }
.seg.active { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; position: relative; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background .15s; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch-row input:checked + .switch-ui { background: var(--orange); }
.switch-row input:checked + .switch-ui::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }
.page > .card { margin-top: 12px; }
.page > .btn-block { margin-top: 16px; }

/* ---- Receipt ---- */
.receipt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 4px 0 10px 8px; display: flex; flex-direction: column; }
.timeline li::before { content: ''; position: absolute; left: -23px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.timeline li.ev-landed::before { background: var(--green); }
.timeline li.ev-failed::before { background: var(--red); }
.timeline li.ev-processing::before { background: var(--violet); }
.print-only { display: none; }

/* ---- Luz panel ---- */
dialog.luz {
  width: 100%; max-width: var(--shell); height: 100%; max-height: 100%; margin: 0 auto; padding: 0;
  border: 0; background: var(--surface); color: var(--text);
}
dialog.luz::backdrop { background: rgba(0, 0, 0, .6); }
.luz-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 22px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.luz-head p { margin: 0; display: flex; align-items: center; gap: 6px; }
.luz-body { padding: 16px 22px 32px; display: flex; flex-direction: column; gap: 12px; }
.luz-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.luz-card p { margin: 0 0 8px; }
.luz-card .btn { margin-top: 4px; }
.luz-log { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.bubble { margin: 0; padding: 10px 12px; border-radius: 14px; font-size: 14px; max-width: 90%; }
.bubble.me { align-self: flex-end; background: var(--card-2); }
.bubble.luz { align-self: flex-start; background: color-mix(in srgb, var(--violet) 18%, transparent); }
.luz-ask { display: flex; gap: 8px; }
.luz-ask input { flex: 1; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); padding: 0 14px; }

/* ---- Dialog / toast / loading ---- */
dialog.dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); color: var(--text); padding: 20px; max-width: 360px; width: calc(100% - 40px); }
dialog.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog-body { margin: 0 0 18px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(var(--shell) - 44px); width: max-content; padding: 12px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 500; font-size: 14px; transition: all .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); color: #fff; }
.toast.success { background: var(--green); color: #08070B; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 0; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 560px) {
  body { padding: 0; }
  .shell { box-shadow: 0 0 0 1px var(--line); }
}

@media print {
  body { background: #fff; color: #000; }
  .header, .action-bar, .no-print, .demo-banner, .toast { display: none !important; }
  .shell { box-shadow: none; max-width: none; background: #fff; }
  .print-only { display: block; }
  .receipt-logo { width: 64px; filter: invert(1); }
  .card { border-color: #ccc; background: #fff; }
}
