:root {
  --ink: #1d2733; --muted: #5f6b7a; --line: #e3e7ec; --bg: #f5f7fa;
  --brand: #0b3d63; --accent: #1f7a5a; --danger: #b3261e;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
body { margin: 0; background: var(--bg); }
main { max-width: 1120px; margin: 2rem auto; padding: 0 1rem; }

.banner { display: flex; gap: 1.5rem; align-items: center; padding: .8rem 1.5rem; color: #fff; background: var(--brand); flex-wrap: wrap; }
/* The serving region is the whole top bar: Sweden (blue, yellow) or the UK (navy, white, red). */
.banner.env-stockholm { background: #006AA7; border-bottom: 8px solid #FECC02; }
/* London: navy with a Union Jack edge (white-red-white) and the name on a red plate. Red is
   fine here; only AZ and cluster tags avoid it. */
.banner.env-london { background: #012169; border-top: 6px solid #C8102E; border-bottom: 10px solid #C8102E; box-shadow: inset 0 -4px 0 #fff, inset 0 4px 0 #fff; }
.env-london .region-name { color: #fff; background: #C8102E; padding: .12em .4em .16em; border-radius: 6px; box-shadow: 0 0 0 2px #fff; }
.region { display: flex; align-items: center; gap: .6rem; }
.region-name { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: .01em; }
.env-stockholm .region-name { color: #FECC02; }
.flag { display: block; width: 2.6rem; height: auto; flex: none; border-radius: 3px; box-shadow: 0 0 0 2px #fff; }
.banner .flag { width: 3rem; }
.brand { font-weight: 700; font-size: 1.2rem; letter-spacing: .02em; }
.served { font-size: .9rem; opacity: .95; flex: 1 1 20rem; min-width: 0; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; }
.card.narrow { max-width: 380px; margin: 3rem auto; }
h1 { margin-top: 0; font-size: 1.4rem; }
h2 { font-size: 1.05rem; margin-top: 1.8rem; }
.muted { color: var(--muted); font-size: .9rem; }
.amount { font-size: 2.2rem; font-weight: 700; margin-top: .2rem; }

form label { display: block; margin-bottom: .9rem; font-size: .9rem; }
input { display: block; width: 100%; box-sizing: border-box; padding: .6rem; margin-top: .3rem; border: 1px solid var(--line); border-radius: 6px; font-size: 1rem; }
button { padding: .6rem 1.1rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer; }
button.secondary { background: var(--brand); }
button.link { background: none; color: var(--brand); padding: 0; text-decoration: underline; }
.transact { display: flex; gap: .5rem; margin-top: 1.2rem; }
.transact input { margin: 0; flex: 1; }
.logout { display: flex; justify-content: space-between; margin-bottom: 1rem; font-size: .9rem; }

.flash { padding: .6rem .8rem; border-radius: 6px; background: #e8f5ee; color: var(--accent); }
.flash.error { background: #fbe9e7; color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sub { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }
.tag { display: inline-block; padding: .1rem .45rem; border-radius: 4px; background: #eef2f7; font-size: .8rem; white-space: nowrap; }
.tag.internal { background: #fff4e5; color: #8a4b00; vertical-align: middle; }
/* Clusters: solid Swedish blue (yellow text) vs white with a navy outline (London). */
.tag.env-stockholm { background: #006AA7; color: #FECC02; font-weight: 700; box-shadow: inset 0 0 0 1.5px #006AA7; }
.tag.env-london { background: #fff; color: #012169; font-weight: 700; box-shadow: inset 0 0 0 1.5px #012169; }

/* Documents (S3) */
.card + .card { margin-top: 1.5rem; }
.card.wide { max-width: 640px; }
h2.first { margin-top: 0; }
.tag.ok { background: #e8f5ee; color: var(--accent); }
.tag.pending { background: #fff4e5; color: #8a4b00; }
.tag.bad { background: #fbe9e7; color: var(--danger); }
a { color: var(--brand); }
a.doclink { text-decoration: none; }
.upload { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
.upload input[type=file] { margin: 0; flex: 1; padding: .45rem; }
.replication { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0 .5rem; }
.repl { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; }
.repl-value { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .3rem; font-size: 1rem; }
.repl-value .tag { font-size: .9rem; padding: .2rem .55rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); max-width: 90vw; box-shadow: 0 4px 16px rgba(0,0,0,.15); z-index: 10; }

/* Availability zones: no red, amber or orange (they read as "down"). The six demo AZs each
   have a colour, light/solid/light per region so the three differ in brightness too. */
.zone { display: inline-block; padding: .1rem .45rem; border-radius: 4px; background: #eef2f7; color: var(--ink); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.zone b { font-weight: 800; }
.zone-a { background: #ede9fe; color: #5b21b6; }
.zone-b { background: #fef3c7; color: #854d0e; }
.zone-c { background: #ffe4e6; color: #9f1239; }
.zone-d { background: #e0f2fe; color: #075985; }
.zone.z-eu-north-1a { background: #dbeafe; color: #1e3a8a; }
.zone.z-eu-north-1b { background: #1d4ed8; color: #fff; }
.zone.z-eu-north-1c { background: #ede9fe; color: #5b21b6; }
.zone.z-eu-west-2a { background: #d1fae5; color: #065f46; }
.zone.z-eu-west-2b { background: #0f766e; color: #fff; }
.zone.z-eu-west-2c { background: #e2e8f0; color: #1e293b; }
.banner .zone { box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.served .zone { margin-left: .2rem; }
.banner .az { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.az-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.az .zone { font-size: 1.35rem; padding: .2rem .7rem; border-radius: 6px; }
@media (max-width: 640px) {
  .banner { gap: .5rem 1rem; padding: .7rem 1rem; }
  .banner .brand { order: 1; flex-basis: 100%; font-size: 1rem; }
  .banner .region { order: 2; }
  .banner .az { order: 3; }
  .region-name { font-size: 1.6rem; }
  .banner .flag { width: 2.4rem; }
  .banner .served { order: 4; flex-basis: 100%; font-size: .8rem; }
  .az .zone { font-size: 1rem; padding: .15rem .5rem; }
  .az-label { display: none; }
  .card { padding: 1.1rem; }
  .replication { grid-template-columns: 1fr; }
  /* Transactions as two-column cards: time | amount, processed by | written to */
  table.txs thead { display: none; }
  table.txs tr { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "time amount" "owner owner" "proc written" "receipt bal";
                 column-gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  table.txs td { border: 0; padding: .1rem 0; min-width: 0; }
  table.txs .c-time { grid-area: time; color: var(--muted); font-size: .8rem; }
  table.txs .c-amount { grid-area: amount; font-weight: 600; }
  table.txs .c-owner { grid-area: owner; font-size: .85rem; }
  table.txs .c-proc { grid-area: proc; }
  table.txs .c-written { grid-area: written; }
  table.txs .c-receipt { grid-area: receipt; }
  table.txs .c-bal { grid-area: bal; color: var(--muted); font-size: .8rem; }
  table.txs .c-bal::before { content: "balance "; }
  table.txs .c-proc::before, table.txs .c-written::before { content: attr(data-label); display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
  table.txs .tag, table.txs .zone { font-size: .75rem; }
  table.txs tr.tx-divider { display: block; padding: 0; }
  table.txs tr.tx-divider td { display: block; }
}
.scroll { overflow-x: auto; }

/* Audience guest accounts (phone first, 375 px) and the projector board */
.join-link { margin: 1.2rem 0 0; font-size: .95rem; }
.guest { max-width: 520px; margin: 0 auto; }
.guest .card + .card { margin-top: 1rem; }
.g-txs { overflow-x: auto; }
/* Laptops: account and verify | the game | transactions; narrower laptops: the game under the
   account on the left, transactions on the right. Phones: one column in page order. */
main:has(.guest) { max-width: 1600px; }
@media (min-width: 960px) {
  .guest { max-width: none; display: grid; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 1rem; align-items: start; }
  .g-txs { padding: 1.2rem 1rem; }
  .g-txs table.txs { font-size: .85rem; }
  .g-txs table.txs th, .g-txs table.txs td { padding: .45rem .45rem; }
  .g-txs table.txs .tag, .g-txs table.txs .zone { font-size: .72rem; padding: .05rem .35rem; }
  .guest .card + .card { margin-top: 0; }
  .guest > .card { grid-column: 1; }
  .guest > .g-txs { grid-column: 2; grid-row: 1 / span 4; }
}
@media (min-width: 1280px) {
  .guest { grid-template-columns: minmax(300px, 330px) minmax(360px, 390px) minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .guest > .g-card { grid-column: 1; grid-row: 1; }
  .guest > .g-verify { grid-column: 1; grid-row: 2; }
  .guest > .g-kyc { grid-column: 1; grid-row: 3; }
  .guest > .g-game { grid-column: 2; grid-row: 1 / span 3; }
  .guest > .g-txs { grid-column: 3; grid-row: 1 / span 3; }
}
@media (min-width: 1600px) {
  .guest { grid-template-columns: minmax(340px, 380px) minmax(400px, 440px) minmax(0, 1fr); }
}
.g-name { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: 1.1rem; margin-bottom: .6rem; }
.g-served { margin-bottom: .5rem; }
.g-served .zone { margin-left: .3rem; }
.g-deposit { display: block; width: 100%; padding: 1.1rem; margin-top: 1rem; font-size: 1.3rem; font-weight: 700; border-radius: 10px; touch-action: manipulation; }
.g-deposit:active { transform: scale(.98); }
/* Deposit status: two lines that are always there with fixed heights (only their text changes),
   so tapping fast never moves the cards below. */
.g-status p { margin: .6rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-queue { height: 1.4rem; line-height: 1.4rem; padding: .45rem .8rem; border-radius: 6px; background: #eef2f7; color: var(--muted); font-size: .9rem; }
.g-queue.g-idle { background: #e8f5ee; color: var(--accent); font-weight: 600; }
.g-queue.g-wait { background: #fff4e5; color: #8a4b00; font-weight: 600; }
.g-queue.g-down { background: #fde68a; color: #713f12; font-weight: 600; }
.g-queue.g-note { background: #fff4e5; color: #8a4b00; }
.g-queue.g-stop { background: #fbe9e7; color: var(--danger); font-weight: 600; }
.g-status p.g-last { height: 2.8rem; line-height: 1.4rem; font-size: .88rem; white-space: normal; }
.g-last .tag { font-size: .75rem; }
.g-ok { color: var(--accent); font-weight: 600; }
/* The drone game (game/ ?embed, London) in a frame; guest.js sets its height from the game. */
.g-game { padding: 0; overflow: hidden; background: #f4f1e8; }
.g-game-frame { display: block; width: 100%; height: 600px; border: 0; }
.g-verify button { width: 100%; }
.g-kyc button { width: 100%; }
/* KYC: S3 in big letters; three rows of fixed height (button or file + status) and a fixed
   status line, so the card keeps its size whatever happens. */
.g-kyc-title { font-size: 1.25rem; margin-bottom: .15rem; }
.g-kyc-line { height: 1.5rem; line-height: 1.5rem; margin: .5rem 0 0; font-size: .9rem; font-weight: 600; color: var(--accent);
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-kyc-line.error { color: var(--danger); }
.g-docs { list-style: none; padding: 0; margin: .4rem 0 0; }
.g-doc { box-sizing: border-box; height: 6.4rem; padding: .55rem 0; border-top: 1px solid var(--line); overflow: hidden; }
.g-doc-type { height: 1.5rem; line-height: 1.5rem; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-doc-type .sub { margin-left: .2rem; }
.g-doc button { margin-top: .4rem; padding: .55rem 1rem; }
.g-doc-file { height: 1.4rem; line-height: 1.4rem; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-doc-where { font-size: .85rem; line-height: 1.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-doc-where .tag { font-size: .78rem; }
.g-kyc .muted { margin-bottom: 0; font-size: .8rem; }
/* Verify result: the lines wrap (no ellipsis) inside a fixed height that fits them at 320 px+. */
.g-result { margin-top: .8rem; padding: .6rem 1rem; border-radius: 8px; line-height: 1.45; height: 7.25rem; overflow: hidden; background: #f5f7fa; }
.g-result.ok { background: #e8f5ee; color: var(--accent); }
.g-result.bad { background: #fbe9e7; color: var(--danger); }
.board { margin-top: 1rem; }
.board h1 { font-size: 2.6rem; margin-bottom: 1.5rem; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.6rem 2rem; }
.tile-n { font-size: 5rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-l { font-size: 1.5rem; color: var(--muted); }
.tile.ok { background: #e8f5ee; border-color: #b7e0c9; }
.tile.ok .tile-n { color: var(--accent); }
.tile.bad { background: #fbe9e7; border-color: #f2b8b5; }
.tile.bad .tile-n { color: var(--danger); }
.results .sub { font-size: 1.1rem; margin-top: 1.2rem; }
@media (max-width: 640px) {
  .guest .amount { font-size: 2rem; }
  .tiles { grid-template-columns: 1fr 1fr; gap: .8rem; }
  .tile { padding: 1rem; }
  .tile-n { font-size: 2.4rem; }
  .tile-l { font-size: 1rem; }
}
main:has(.board) { max-width: 1760px; }
.tag-link { text-decoration: none; } .tag-link:hover .tag { filter: brightness(.95); text-decoration: underline; }

/* Guest: the amount of the next deposit on the button */
.g-amount { font-variant-numeric: tabular-nums; }
/* Region history: deposits per region above the table, a divider row where the region changed */
.g-regions { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.3rem 0 .8rem; }
.g-region { display: flex; align-items: center; gap: .55rem; padding: .45rem .7rem; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; font-size: .88rem; flex: 1 1 14rem; }
.g-region .flag { width: 1.9rem; box-shadow: 0 0 0 1px var(--line); }
.g-region .sub { margin-top: 0; }
.g-region-stockholm { border-color: #006AA7; background: #eef6fb; }
.g-region-london { border-color: #012169; background: #f1f3f9; }
table.txs tr.tx-divider td { padding: .45rem .6rem; background: #012169; color: #fff; font-weight: 700; font-size: .85rem; border: 0; }
table.txs tr.tx-divider.to-stockholm td { background: #006AA7; color: #FECC02; }
table.txs tr.tx-divider.pinned td { background: #eef2f7; color: var(--muted); font-weight: 600; }
/* New rows (guest.js) light up for a moment */
@keyframes tx-new { 0%, 45% { background: #fff3a3; } 100% { background: transparent; } }
table.txs tr.tx-new { animation: tx-new 3s ease-out; }
/* 1280-1599 px laptops: three columns leave the table too narrow for the balance column */
@media (min-width: 1280px) and (max-width: 1599px) {
  .g-txs table.txs .c-bal { display: none; }
}
