/* The console: one column for a phone in one hand. Cool paper and blue-black ink; the one loud thing is the payment slip,
   its amount set condensed and large like a bank alert's figure. Green and red only ever mean reconciled and broken. */
:root {
  --paper: #edf0f3;
  --card: #ffffff;
  --ink: #15202b;
  --muted: #55616d;
  --line: #cbd3db;
  --act: #1e4fd8;
  --act-ink: #ffffff;
  --ok: #17784a;
  --ok-bg: #e3f2ea;
  --bad: #b3261e;
  --bad-bg: #fbe7e5;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --brand: #c2410c;
  --focus: #1e4fd8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d141b; --card: #16202a; --ink: #e7edf3; --muted: #9aa7b4; --line: #2a3744;
    --act: #8db0ff; --act-ink: #0d141b; --ok: #5fd39a; --ok-bg: #12301f; --bad: #ff8a80; --bad-bg: #3a1715;
    --warn: #f3c46b; --warn-bg: #33260b; --brand: #ff7a45; --focus: #8db0ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d141b; --card: #16202a; --ink: #e7edf3; --muted: #9aa7b4; --line: #2a3744;
  --act: #8db0ff; --act-ink: #0d141b; --ok: #5fd39a; --ok-bg: #12301f; --bad: #ff8a80; --bad-bg: #3a1715;
  --warn: #f3c46b; --warn-bg: #33260b; --brand: #ff7a45; --focus: #8db0ff; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 Archivo, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom);
}
p, h1, h2, h3, ul, dl, dd { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.bar {
  display: flex; align-items: center; gap: 8px;
  max-width: 36rem; margin: 0 auto; padding: 14px 16px 6px;
}
.mark { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; margin-right: auto; line-height: 1.2; }
.mark .bang { color: var(--brand); }
.mark .role { font-weight: 500; font-stretch: 85%; color: var(--muted); letter-spacing: 0; }
.quiet {
  background: none; border: 0; padding: 10px 8px; min-height: 44px;
  color: var(--act); font-weight: 600; font-size: 15px; cursor: pointer; border-radius: 8px; white-space: nowrap;
}

main { max-width: 36rem; margin: 0 auto; padding: 8px 16px 48px; outline: none; }
.loading { color: var(--muted); padding: 32px 0; }
.muted { color: var(--muted); }
.bad-text { color: var(--bad); margin-top: 8px; }

/* Sign-in */
.signin { padding: 40px 0 24px; }
.signin h1 { font-size: 30px; line-height: 1.15; font-weight: 800; font-stretch: 90%; letter-spacing: -0.02em; max-width: 18ch; }
.signin .lede { color: var(--muted); margin: 12px 0 28px; max-width: 34ch; }
#gsi { min-height: 44px; margin-bottom: 12px; }

/* The home's verdict: one line that says "fine" or "look". */
.status { padding: 20px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.status h1 { font-size: 34px; line-height: 1.1; font-weight: 800; font-stretch: 88%; letter-spacing: -0.025em; }
.status.clear h1::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); margin: 0 12px 4px 0; vertical-align: middle; }
.status p { color: var(--muted); margin-top: 6px; }
.status ul { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 6px; }
.status li a {
  display: block; padding: 12px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.status li a::after { content: ""; float: right; width: 8px; height: 8px; margin-top: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); }

.block { padding: 28px 0 8px; scroll-margin-top: 12px; }
.block h2 { font-size: 21px; line-height: 1.25; font-weight: 750; letter-spacing: -0.01em; margin-bottom: 12px; }
.block > .muted { margin-bottom: 12px; }
.count {
  display: inline-block; min-width: 26px; padding: 0 8px; border-radius: 13px; background: var(--bad); color: var(--card);
  font-size: 15px; line-height: 26px; text-align: center; vertical-align: 3px;
}

/* The slip: a bank alert torn off the roll. Notched top edge, the amount as the headline. */
.slip {
  position: relative; background: var(--card); border-radius: 0 0 14px 14px; padding: 22px 16px 16px; margin: 12px 0 18px;
  box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line);
  scroll-margin-top: 16px; outline: none;
}
.slip::before {
  content: ""; position: absolute; left: 0; right: 0; top: -7px; height: 8px;
  background: radial-gradient(circle at 7px 0, transparent 6px, var(--card) 6.5px) 0 0 / 14px 8px repeat-x;
}
.slip.focus { box-shadow: 0 0 0 2px var(--act); }
.slip .amount { font-size: 46px; line-height: 1; font-weight: 750; font-stretch: 70%; letter-spacing: -0.01em; }
.slip .amount .cur { font-size: 17px; font-weight: 600; font-stretch: 100%; color: var(--muted); vertical-align: 18px; margin-right: 2px; }
.slip .payer { font-size: 19px; font-weight: 650; margin-top: 10px; overflow-wrap: anywhere; }
.slip .when { color: var(--muted); font-size: 15px; }
.slip .why { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--paper); font-size: 15px; }
.slip h3 { font-size: 15px; font-weight: 650; color: var(--muted); margin: 18px 0 8px; }
.cands { list-style: none; padding: 0; display: grid; gap: 10px; }
.cands li { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 2px; }
.cands .ref { font-weight: 700; overflow-wrap: anywhere; }
.cands .muted { font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.tag { font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.more .secondary { flex: 1 1 140px; }

/* Buttons: big, thumb-sized, never hover-only. */
.primary, .secondary {
  min-height: 48px; padding: 10px 16px; border-radius: 10px; font-weight: 650; font-size: 16px; cursor: pointer; touch-action: manipulation;
}
.primary { background: var(--act); color: var(--act-ink); border: 0; }
.primary.danger { background: var(--bad); color: var(--card); }
.secondary { background: transparent; color: var(--act); border: 1.5px solid var(--line); }
.secondary[aria-expanded="true"] { border-color: var(--act); }
.wide { width: 100%; margin-top: 8px; }
button:active { transform: translateY(1px); }

.panel { display: grid; gap: 10px; margin-top: 12px; }
.panel[hidden] { display: none; }
label { display: grid; gap: 4px; font-size: 15px; font-weight: 600; color: var(--muted); }
input, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 17px; font-weight: 400;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--act); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--act) 25%, transparent); }
.field-error { color: var(--bad); font-size: 15px; min-height: 0; }
.field-error:empty { display: none; }
#wallet-grant .panel { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: 0 0 0 1px var(--line); }

/* The last closed day. */
.recon { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-weight: 600; margin-bottom: 14px; }
.recon .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; background: currentColor; }
.recon.ok { background: var(--ok-bg); color: var(--ok); }
.recon.bad { background: var(--bad-bg); color: var(--bad); }
.recon.warn { background: var(--warn-bg); color: var(--warn); margin-top: 14px; }
.figures { background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line); padding: 4px 16px; }
.figures .row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.figures .row:first-child { border-top: 0; }
.figures dt { color: var(--muted); }
.figures dd { font-weight: 700; text-align: right; white-space: nowrap; }

/* The confirm step: a sheet from the bottom on a phone, a centred card on a wide screen. */
dialog {
  border: 0; padding: 22px 16px calc(16px + env(safe-area-inset-bottom)); width: 100%; max-width: 36rem;
  margin: auto auto 0; border-radius: 18px 18px 0 0; background: var(--card); color: var(--ink);
}
dialog::backdrop { background: rgb(13 20 27 / 0.55); }
dialog[open] { animation: rise 180ms ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
dialog h2 { font-size: 22px; font-weight: 800; font-stretch: 90%; letter-spacing: -0.01em; margin-bottom: 12px; }
dialog .effect { display: grid; gap: 8px; font-size: 18px; font-weight: 600; }
dialog .note { color: var(--muted); margin: 12px 0 18px; font-size: 15px; }
dialog .actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
@media (min-width: 640px) {
  dialog { margin: auto; border-radius: 18px; max-width: 30rem; padding: 24px; }
}

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 34rem; margin: 0 auto;
  padding: 14px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); font-weight: 600;
  transform: translateY(150%); visibility: hidden; transition: transform 200ms ease-out, visibility 0s 200ms; pointer-events: none;
}
#toast.show { transform: none; visibility: visible; transition: transform 200ms ease-out; }
#toast[data-kind="bad"] { background: var(--bad); color: var(--card); }

@media (prefers-reduced-motion: reduce) {
  dialog[open] { animation: none; }
  #toast { transition: none; }
}

/* Refunds to send: quieter than a slip; where to send appears only after the case. */
.refund { background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line); padding: 16px; margin: 12px 0; display: grid; gap: 4px; }
.amount.small { font-size: 34px; line-height: 1; font-weight: 750; font-stretch: 70%; }
.amount.small .cur { font-size: 15px; font-weight: 600; font-stretch: 100%; color: var(--muted); vertical-align: 12px; margin-right: 2px; }
.refund .when { color: var(--muted); font-size: 15px; }
.tag.plain { background: var(--paper); color: var(--muted); }
.small-text { font-size: 15px; }
.figures.where { box-shadow: none; border: 1px solid var(--line); }
.figures.where dd { white-space: normal; overflow-wrap: anywhere; }
.panel .recon.warn { margin: 0; font-weight: 500; }
[hidden] { display: none !important; }
