/* The bank host emulator's portal.
   Deliberately not styled like the ZAM issuer portal: someone with both open
   should never have to look twice to know which system they are changing. */

:root {
  --bank: #1a4d2e;
  --bank-secondary: #1a4d2e;
  --bank-accent: #c8a44d;
  --ink: #16181d;
  --ink-soft: #5b6472;
  --ink-faint: #8b93a1;
  --line: #e3e6ea;
  --surface: #ffffff;
  --canvas: #f5f6f8;
  --good: #17754a;
  --good-bg: #e6f4ec;
  --warn: #8a6100;
  --warn-bg: #fdf2dc;
  --bad: #a3231f;
  --bad-bg: #fbeae9;
  --neutral: #4b5563;
  --neutral-bg: #eef0f3;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bank); }

/* ---------------------------------------------------------------- chrome */

.topbar {
  background: var(--bank);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  height: 54px;
}

.topbar-brand { display: flex; align-items: baseline; gap: .6rem; color: #fff; text-decoration: none; }
/* The bank's own mark, on the bank's own colour. Logos are drawn for light
   backgrounds far more often than dark ones, so it sits on a light plate rather
   than being dropped straight onto the bar and disappearing. */
.topbar-logo {
  height: 26px; width: auto; max-width: 110px;
  background: #fff; border-radius: 5px; padding: 3px 6px;
  align-self: center;
}
.topbar-brand strong { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.topbar-brand span { font-size: .78rem; color: rgba(255,255,255,.72); }

.chip-emulator {
  font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
  color: #fff; padding: .18rem .45rem; border-radius: 4px;
}

/* The accent marks the current page in the sidebar — one clear job, so a bank's
   third colour reads as deliberate rather than decorative. */
.sidebar a.active { box-shadow: inset 2px 0 0 var(--bank-accent); }

.topbar-user { display: flex; align-items: center; gap: .85rem; font-size: .82rem; }
.topbar-user span { color: rgba(255,255,255,.8); }
.topbar-user a {
  color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.35);
  padding: .25rem .6rem; border-radius: 6px;
}
.topbar-user a:hover { background: rgba(255,255,255,.12); }

.shell { display: flex; min-height: calc(100vh - 54px); align-items: flex-start; }

.sidebar {
  width: 208px; flex: 0 0 208px; background: var(--surface);
  border-right: 1px solid var(--line); padding: 1rem .6rem; min-height: calc(100vh - 54px);
}
.sidebar h6 {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-faint); padding: .8rem .65rem .3rem; font-weight: 600;
}
.sidebar a {
  display: block; padding: .44rem .65rem; border-radius: 7px; color: var(--ink-soft);
  text-decoration: none; font-size: .875rem;
}
.sidebar a:hover { background: var(--canvas); color: var(--ink); }
.sidebar a.active { background: var(--canvas); color: var(--bank); font-weight: 600; }

main { flex: 1; padding: 1.6rem 1.9rem 3rem; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.page-head h1 { font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.page-head p { color: var(--ink-soft); font-size: .875rem; margin-top: .15rem; }

/* --------------------------------------------------------------- surfaces */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 1.1rem;
}
.card > h2 {
  font-size: .93rem; font-weight: 620; padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
}
.card > h2 small { font-weight: 400; color: var(--ink-faint); margin-left: .4rem; }
.card-body { padding: 1rem; }

.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.stat dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 600; }
.stat dd { font-size: 1.4rem; font-weight: 640; letter-spacing: -.02em; margin-top: .2rem; }
.stat dd small { font-size: .8rem; font-weight: 500; color: var(--ink-faint); }

/* ---------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-faint); font-weight: 600; padding: .55rem 1rem; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: .6rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .82em; }
.muted { color: var(--ink-faint); }
.table-scroll { overflow-x: auto; }

.empty { padding: 1.6rem 1rem; text-align: center; color: var(--ink-faint); font-size: .875rem; }

/* --------------------------------------------------------------- badges */

.badge {
  display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  padding: .13rem .45rem; border-radius: 5px; white-space: nowrap;
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 7px;
  font: inherit; font-size: .875rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--bank) 35%, white); outline-offset: 0; border-color: var(--bank); }
.field { margin-bottom: .75rem; }
.field-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.field-row > .field { flex: 1 1 150px; margin-bottom: 0; }
.hint { font-size: .76rem; color: var(--ink-faint); margin-top: .25rem; }

button, .btn {
  font: inherit; font-size: .85rem; font-weight: 560; cursor: pointer;
  padding: .44rem .85rem; border-radius: 7px; border: 1px solid transparent;
  background: var(--bank); color: #fff; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--canvas); filter: none; }
.btn-danger { background: var(--bad); }
.btn-small { padding: .25rem .55rem; font-size: .78rem; }
.inline-form { display: inline; }

/* --------------------------------------------------------------- notices */

.notice, .alert {
  border-radius: var(--radius); padding: .7rem .95rem; font-size: .87rem; margin-bottom: 1rem;
  border: 1px solid;
}
.notice { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 25%, white); color: var(--good); }
.alert { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, white); color: var(--bad); }
.warning { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, white); color: var(--warn); }

/* ----------------------------------------------------------------- login */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--canvas); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.9rem; }
.auth-card h1 { font-size: 1.2rem; font-weight: 640; letter-spacing: -.02em; }
.auth-card .lede { color: var(--ink-soft); font-size: .87rem; margin: .3rem 0 1.3rem; }
.auth-brand { display: flex; align-items: center; gap: .55rem; margin-bottom: 1.3rem; }
.auth-logo { height: 34px; width: auto; max-width: 130px; }

/* Branding makes the sign-in page look like the bank's own. This says, on the
   page itself and not only in the tab title, that it is not. */
.auth-emulator {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--warn); background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, white);
  border-radius: 6px; padding: .3rem .5rem; margin-bottom: 1.2rem; text-align: center;
}
.auth-brand .dot { width: 26px; height: 26px; border-radius: 7px; background: var(--bank); display: grid; place-items: center; color: #fff; font-size: .7rem; font-weight: 700; }
.auth-card button { width: 100%; margin-top: .4rem; padding: .55rem; }
.code-input { font-family: var(--mono); font-size: 1.5rem; letter-spacing: .3em; text-align: center; }

/* The sign-in code shown on screen when there is no relay to email it. Marked
   out as a development affordance rather than dressed up as part of the flow —
   nobody should mistake this for something a real bank portal does. */
.dev-code {
  border: 1px dashed color-mix(in srgb, var(--warn) 45%, white);
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: .8rem .95rem 1rem;
  margin-bottom: 1.1rem;
  text-align: center;
}
.dev-code-label {
  font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--warn);
}
.dev-code-value {
  font-family: var(--mono); font-size: 1.75rem; font-weight: 600; letter-spacing: .22em;
  color: var(--ink); margin: .3rem 0 .35rem;
}
.dev-code-hint { font-size: .76rem; line-height: 1.45; color: var(--warn); }

/* ------------------------------------------------------------ code blocks */

pre.body {
  background: #fbfbfc; border: 1px solid var(--line); border-radius: 7px;
  padding: .6rem .7rem; font-family: var(--mono); font-size: .76rem;
  white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto;
  color: var(--ink-soft);
}
details summary { cursor: pointer; font-size: .8rem; color: var(--bank); }

.key-reveal {
  font-family: var(--mono); font-size: .85rem; background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, white); border-radius: 7px;
  padding: .6rem .7rem; word-break: break-all; color: var(--ink);
}

.linkcode {
  font-family: var(--mono); font-size: 1.6rem; font-weight: 600; letter-spacing: .12em;
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .2rem; }
  .sidebar h6 { display: none; }
  main { padding: 1.1rem; }
}
