/*
 * TFG Accounts. Served by src/ui/routes/assets.ts at a content-hashed path. Every file this sheet
 * names is given by its name under assets/, in double quotes, and is rewritten to its hashed path at
 * boot (src/ui/assets.ts); any other form fails the boot.
 * No inline styles anywhere (CSP default-src 'self'), no script. Every animation and transition is
 * inside `prefers-reduced-motion: no-preference`.
 *
 * Direction: a private bank's sign-in, current. White and cool mist, deep navy type, one cobalt for
 * what you can act on. The owner's chart sits far back under soft blue light, and the sign-in card is
 * a pane of frosted glass over it, its edge catching the light. Instrument Sans for the interface and
 * titles, Plex Mono only for keys and ids.
 */

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-400-normal.9a91efaa3599.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-500-normal.9d3547da16d9.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans-latin-600-normal.efb770916eda.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.08949f728dc5.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Surfaces */
  --paper: #ffffff;
  --mist: #f3f6fa;
  --wash: #eef2f8;
  --fill: #f7f9fc;
  --line: #e3e8ef;
  --line-soft: #edf0f5;
  --field-line: #7b8599;
  /* Type */
  --ink: #0e1e3d;
  --ink-soft: #26365a;
  --slate: #566278;
  /* The accent: what you can act on */
  --azure: #2b58d8;
  --cobalt: #1f45b8;
  --cobalt-hi: #17358f;
  --cobalt-line: rgba(31, 69, 184, 0.3);
  --glow: 0 0 0 4px rgba(31, 69, 184, 0.16);
  /* Status, only for status */
  --up: #15703f;
  --down: #b3261e;
  --warn: #a14a00;
  --warn-edge: #c26a0a;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Depth */
  --shadow-sm: 0 1px 2px rgba(14, 30, 61, 0.06);
  --shadow-card: 0 1px 1px rgba(14, 30, 61, 0.03), 0 2px 6px -2px rgba(14, 30, 61, 0.06), 0 20px 40px -28px rgba(14, 30, 61, 0.22);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Keyboard focus never lands under the sticky top bar: scrolling a control into view leaves room for it. */
html {
  scroll-padding-top: 5rem;
  scroll-padding-bottom: 1rem;
  background: var(--mist);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font: 400 1rem/1.55 var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1 {
  margin: 0 0 1.25rem;
  font: 600 1.75rem/1.15 var(--sans);
  letter-spacing: -0.025em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

h2 {
  margin: 2.5rem 0 0.75rem;
  font: 600 0.75rem/1.4 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}

p {
  margin: 0 0 1rem;
}

strong {
  font-weight: 600;
}

/* Links: a faint resting underline (links in text never rely on colour alone), drawn in full on hover. */
a {
  color: var(--cobalt);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(var(--cobalt-line), var(--cobalt-line));
  background-size: 0% 1px, 100% 1px;
  background-position: 0 100%, 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 1px;
}

a:hover {
  color: var(--cobalt-hi);
  background-size: 100% 1px, 100% 1px;
}

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  font: 400 0.875em/1.4 var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  color: var(--ink-soft);
}

img {
  display: block;
  margin: 0 0 1rem;
  border-radius: 50%;
  outline: 1px solid var(--line);
  outline-offset: 4px;
  box-shadow: 0 10px 24px -12px rgba(14, 30, 61, 0.45);
}

/* ---------- The wordmark: type only, no box, no rule ---------- */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}

.wordmark-tfg {
  font: 600 1.25rem/1 var(--sans);
  letter-spacing: 0.06em;
  color: var(--ink);
}

.wordmark-name {
  padding-left: 0.7rem;
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  /* Ink-soft, not slate: on the sign-in pages it can sit over a candle under the cobalt glow. */
  color: var(--ink-soft);
  border-left: 1px solid #c9d1de;
}

/* ---------- Auth pages: a glass card over the chart, under soft blue light ---------- */

/*
 * Bottom up: the owner's chart, its greys turned pale blue by a cobalt `screen` layer and lifted by a
 * veil; fades that hide its top border and its price axis; then the light: a cobalt glow that reaches
 * the card's upper left, an azure one at its lower right, and a wide wash of light from above. The
 * glass picks up both, so it reads as glass and not as a white box.
 */
.page-auth {
  background-color: var(--wash);
  background-image:
    radial-gradient(70% 55% at 50% -8%, rgba(43, 88, 216, 0.12), rgba(43, 88, 216, 0) 72%),
    radial-gradient(34% 40% at 37% 30%, rgba(43, 88, 216, 0.24), rgba(43, 88, 216, 0) 72%),
    radial-gradient(34% 44% at 65% 74%, rgba(28, 128, 226, 0.2), rgba(28, 128, 226, 0) 72%),
    radial-gradient(28% 30% at 50% 50%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 70%),
    linear-gradient(90deg, rgba(238, 242, 248, 0) 68%, var(--wash) 90%),
    linear-gradient(180deg, var(--wash), rgba(238, 242, 248, 0) 10%),
    linear-gradient(rgba(246, 248, 252, 0.35), rgba(246, 248, 252, 0.35)),
    linear-gradient(var(--cobalt), var(--cobalt)),
    url("/assets/chart-bg.fa51e83f9feb.png");
  background-blend-mode: normal, normal, normal, normal, normal, normal, normal, screen, normal;
  background-size: auto, auto, auto, auto, auto, auto, auto, auto, cover;
  background-position: center, center, center, center, center, center, center, center, 30% center;
  background-repeat: no-repeat;
}

.auth {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 2rem 0 3rem;
}

/* Auto margins centre the pair, and give way (no clipping) when the page is taller than the frame. */
.auth > .brand {
  display: flex;
  justify-content: center;
  margin: auto 0 1.6rem;
}

.card {
  position: relative;
  width: min(25.5rem, calc(100% - 2rem));
  margin: 0 auto auto;
  padding: 2.25rem 2.25rem 2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow:
    0 1px 2px rgba(14, 30, 61, 0.06),
    0 10px 28px -10px rgba(14, 30, 61, 0.14),
    0 40px 80px -36px rgba(23, 53, 143, 0.38);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card {
    background: rgba(255, 255, 255, 0.74);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
  }
}

/* The glass edge: a gradient hairline that is bright where the light comes from, blue where it leaves. */
@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
  .card {
    border-color: transparent;
  }

  .card::before {
    content: "";
    position: absolute;
    inset: -1px;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.5) 28%, rgba(31, 69, 184, 0.16) 62%, rgba(31, 69, 184, 0.34) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
  }
}

.card h1 {
  margin-bottom: 1.5rem;
}

.card .links {
  margin: 1.6rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(14, 30, 61, 0.08);
}

/* ---------- Forms: one language everywhere ---------- */

label {
  display: block;
  margin: 0 0 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.72rem 0.9rem;
  font: 400 1rem/1.3 var(--sans);
  color: var(--ink);
  background: var(--fill);
  border: 1px solid var(--field-line);
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(14, 30, 61, 0.07);
}

input:hover,
select:hover,
textarea:hover {
  background-color: var(--paper);
  border-color: var(--ink-soft);
}

/* Focus: the border turns cobalt and doubles, inside a soft blue glow. The transparent outline shows in forced colours. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 0;
  background-color: var(--paper);
  border-color: var(--cobalt);
  box-shadow: inset 0 1px 2px rgba(14, 30, 61, 0.04), 0 0 0 1px var(--cobalt), var(--glow);
}

/* Filled: a required field with a value sits on white. */
input:required:valid {
  background-color: var(--paper);
}

/* Invalid, after the user has touched it (the browser's own check: required, email). */
input:user-invalid {
  border-color: var(--down);
  box-shadow: inset 0 1px 2px rgba(14, 30, 61, 0.04), 0 0 0 1px var(--down);
}

input:user-invalid:focus-visible {
  box-shadow: inset 0 1px 2px rgba(14, 30, 61, 0.04), 0 0 0 1px var(--down), 0 0 0 4px rgba(179, 38, 30, 0.16);
}

/* The browser's autofill, in the theme's blue instead of its own yellow. */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: inset 0 0 0 100px #eef3ff;
}

input:-webkit-autofill:focus-visible {
  box-shadow: inset 0 0 0 100px #eef3ff, 0 0 0 1px var(--cobalt), var(--glow);
}

input::placeholder {
  color: var(--slate);
  opacity: 1;
}

input[type="checkbox"] {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin: 0 0.5rem 0 0;
  vertical-align: -0.15em;
  accent-color: var(--cobalt);
  box-shadow: none;
}

input[type="file"] {
  padding: 0.45rem;
  font-size: 0.875rem;
}

input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.45rem 0.85rem;
  font: 600 0.8125rem/1.2 var(--sans);
  color: var(--cobalt);
  background: var(--paper);
  border: 1px solid var(--cobalt-line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.hint {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--slate);
}

p.hint {
  margin: 0 0 1rem;
}

/* Primary: a cobalt gradient that deepens on hover (the gradient is twice the height and slides). */
button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  overflow: hidden;
  isolation: isolate;
  font: 600 0.9375rem/1.2 var(--sans);
  letter-spacing: 0.005em;
  color: var(--paper);
  background: linear-gradient(180deg, var(--azure) 0%, var(--cobalt) 50%, var(--cobalt-hi) 100%);
  background-size: 100% 200%;
  background-position: 0 0;
  border: 1px solid #1b3da8;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(14, 30, 61, 0.2), 0 8px 18px -8px rgba(31, 69, 184, 0.6);
  cursor: pointer;
}

/* The sheen: a soft band of light that crosses the button once on hover. */
button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.24) 50%, rgba(255, 255, 255, 0) 70%);
  transform: translateX(-120%);
  pointer-events: none;
}

button:hover {
  background-position: 0 100%;
  border-color: var(--cobalt-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 4px rgba(14, 30, 61, 0.18), 0 14px 28px -12px rgba(31, 69, 184, 0.7);
}

button:active {
  background-position: 0 100%;
  box-shadow: inset 0 2px 5px rgba(8, 18, 54, 0.4), 0 1px 1px rgba(14, 30, 61, 0.15);
}

button:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
  border-radius: 10px;
}

/* Secondary: row actions and admin actions, white with a cobalt hairline. */
.items button,
form.inline button,
.devices-all button,
.media-body form.links button {
  width: auto;
  padding: 0.5rem 0.95rem;
  font-size: 0.8125rem;
  color: var(--cobalt);
  background: var(--paper);
  border-color: var(--cobalt-line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.items button::after,
form.inline button::after,
.devices-all button::after,
.media-body form.links button::after {
  display: none;
}

.items button:hover,
form.inline button:hover,
.devices-all button:hover,
.media-body form.links button:hover {
  color: var(--cobalt-hi);
  background: #f2f5ff;
  border-color: var(--cobalt);
  box-shadow: 0 1px 2px rgba(14, 30, 61, 0.08), 0 6px 14px -8px rgba(31, 69, 184, 0.45);
}

.items button:active,
form.inline button:active,
.devices-all button:active,
.media-body form.links button:active {
  background: #e9eefd;
  box-shadow: inset 0 1px 2px rgba(14, 30, 61, 0.12);
}

/* A search or filter (GET) is the page's main action again. */
form.inline[method="get"] button {
  color: var(--paper);
  background: linear-gradient(180deg, var(--azure) 0%, var(--cobalt) 50%, var(--cobalt-hi) 100%);
  background-size: 100% 200%;
  border-color: #1b3da8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(14, 30, 61, 0.2), 0 6px 14px -8px rgba(31, 69, 184, 0.6);
}

form.inline[method="get"] button::after {
  display: block;
}

form.inline[method="get"] button:hover {
  color: var(--paper);
  background-position: 0 100%;
  border-color: var(--cobalt-hi);
}

button.danger,
form.inline button.danger,
.media-body form.links button {
  color: var(--down);
  background: var(--paper);
  border-color: rgba(179, 38, 30, 0.35);
}

button.danger:hover,
form.inline button.danger:hover,
.media-body form.links button:hover {
  color: var(--down);
  background: #fdf3f2;
  border-color: var(--down);
  box-shadow: 0 1px 2px rgba(14, 30, 61, 0.08), 0 6px 14px -8px rgba(179, 38, 30, 0.45);
}

.links {
  margin: 1.5rem 0 0;
  font-size: 0.875rem;
  color: var(--slate);
}

/* ---------- Status lines ---------- */

.error,
.notice {
  margin: 0 0 1.25rem;
  padding: 0.8rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  border: 1px solid;
  border-radius: 10px;
}

.error {
  color: #8c1d17;
  background: #fcf1f0;
  border-color: #efcdca;
}

.notice {
  color: #0f5a32;
  background: #eff7f2;
  border-color: #c4e0cf;
}

/* ---------- Pills: status in text, repeated in colour ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.14rem 0.6rem 0.14rem 0.5rem;
  font: 500 0.75rem/1.35 var(--sans);
  letter-spacing: 0.01em;
  white-space: normal;
  vertical-align: 0.05em;
  border: 1px solid;
  border-radius: 999px;
}

.pill::before {
  content: "";
  flex: 0 0 auto;
  width: 0.4rem;
  height: 0.4rem;
  background: currentColor;
  border-radius: 50%;
}

.pill-up {
  color: var(--up);
  background: rgba(21, 112, 63, 0.08);
  border-color: rgba(21, 112, 63, 0.24);
}

.pill-down {
  color: var(--down);
  background: rgba(179, 38, 30, 0.08);
  border-color: rgba(179, 38, 30, 0.24);
}

.pill-warn {
  color: var(--warn);
  background: rgba(161, 74, 0, 0.08);
  border-color: rgba(161, 74, 0, 0.24);
}

.pill-neutral {
  color: var(--slate);
  background: rgba(86, 98, 120, 0.07);
  border-color: rgba(86, 98, 120, 0.22);
}

/* ---------- My account and admin: top bar, side links, main ---------- */

.page-account,
.page-admin {
  --gutter: clamp(1rem, 3vw, 2.5rem);
  --shell-max: 76rem;
  background-image: radial-gradient(70rem 26rem at 18% -6rem, rgba(43, 88, 216, 0.09), rgba(43, 88, 216, 0) 70%);
  background-repeat: no-repeat;
}

.page-admin {
  --shell-max: 100rem;
}

.skip {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 10;
  padding: 0.55rem 0.9rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--cobalt);
  border-radius: 8px;
}

.skip:focus {
  top: 0.75rem;
  color: var(--paper);
}

/* The top bar: frosted, and it stays in view on long pages. */
.masthead {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  min-height: 3.75rem;
  padding: 0.75rem max(var(--gutter), calc((100% - var(--shell-max)) / 2 + var(--gutter)));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .masthead {
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
  }
}

.masthead .wordmark-tfg {
  font-size: 1.125rem;
}

/* The re-auth page: the top bar gets an amber edge. */
.step-up .masthead {
  box-shadow: inset 0 -2px 0 var(--warn-edge);
}

.shell {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  max-width: var(--shell-max);
  min-height: calc(100vh - 3.75rem);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.page-admin .shell {
  grid-template-columns: 11rem minmax(0, 1fr);
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 2.25rem 1.25rem 2rem 0;
  border-right: 1px solid var(--line);
}

/* The nav's own label as its heading: no new copy, and hidden from assistive tech (it has the label). */
.sidenav::before {
  content: attr(aria-label);
  content: attr(aria-label) / "";
  display: block;
  padding: 0 0 0.8rem 0.75rem;
  font: 600 0.6875rem/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}

.sidenav a {
  display: block;
  padding: 0.55rem 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--slate);
  background: none;
  border-radius: 8px;
}

.sidenav a:hover {
  color: var(--ink);
  background: rgba(14, 30, 61, 0.045);
}

.sidenav a[aria-current="page"] {
  font-weight: 600;
  color: var(--cobalt);
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(14, 30, 61, 0.08), 0 0 0 1px rgba(14, 30, 61, 0.06);
}

.shell-main {
  min-width: 0;
  max-width: 48rem;
  padding: 2.25rem 0 4rem 2.75rem;
}

.page-admin .shell-main {
  max-width: none;
  padding-left: 2.25rem;
}

.shell-main h1 {
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

/* ---------- My account: panels and ledgers ---------- */

.panel {
  margin: 0 0 1.25rem;
  padding: 1.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

.panel > :last-child,
.panel form > :last-child {
  margin-bottom: 0;
}

.panel.flush {
  padding: 0;
  overflow: hidden;
}

.panel.empty {
  color: var(--slate);
}

.shell-main button {
  width: auto;
  padding: 0.7rem 1.35rem;
}

.panel form button {
  margin-top: 0.25rem;
}

.media {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  align-items: flex-start;
}

.media > img,
.media > p {
  margin: 0;
}

.media-body {
  flex: 1 1 18rem;
  min-width: 0;
}

.media-body form.links {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}

/* The avatar presets (contract rev 28): one image button each, in a grid under the upload. */
.media-body form.presets {
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}

.presets fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.presets legend {
  margin: 0 0 0.75rem;
  padding: 0;
  font-weight: 600;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shell-main .preset-grid button {
  width: 100%;
  margin: 0;
  padding: 0.2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.preset-grid button::after {
  display: none;
}

.shell-main .preset-grid button:hover {
  background: #f2f5ff;
  border-color: var(--cobalt);
}

.shell-main .preset-grid button.current {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 2px var(--cobalt);
}

.preset-grid img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 7px;
}

/* "Your avatars" (contract rev 30): the member's own pictures above the presets, each with a small
   delete button under its tile, in the page's danger red. */
.shell-main .preset-grid button.forget {
  margin-top: 0.25rem;
  padding: 0.15rem 0;
  font-size: 0.75rem;
  color: var(--down);
  background: var(--paper);
  border-color: rgba(179, 38, 30, 0.35);
  box-shadow: none;
}

.shell-main .preset-grid button.forget:hover {
  color: var(--down);
  background: #fdf3f2;
  border-color: var(--down);
}

/* The box a delete needs (the admin merge's pattern: checked on the server, no script). */
.presets.own label.confirm {
  display: flex;
  align-items: center;
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--slate);
}

.presets.own .hint {
  display: block;
  margin-top: 0.5rem;
}

/* Key-value rows: label beside value, the label quieter. */
dl {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
  margin: 0 0 1.25rem;
}

dt {
  padding: 0.85rem 1.5rem 0.85rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--slate);
  border-top: 1px solid var(--line-soft);
}

dd {
  min-width: 0;
  margin: 0;
  padding: 0.8rem 1.25rem 0.8rem 0;
  overflow-wrap: anywhere;
  border-top: 1px solid var(--line-soft);
}

dt:first-of-type,
dt:first-of-type + dd {
  border-top: 0;
}

dd .hint {
  margin-top: 0.2rem;
}

/* A ledger: one row per key, purchase or device. */
.items {
  margin: 0 0 1.5rem;
  padding: 0;
  overflow: hidden;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

.items > li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.35rem;
  border-top: 1px solid var(--line-soft);
}

.items > li:first-child {
  border-top: 0;
}

.items > li:hover {
  background: #fafbfd;
}

.items > li > * {
  margin: 0;
}

.row-body {
  flex: 1 1 18rem;
  min-width: 0;
}

.items > li > form,
.items > li > .pill,
.items > li > .action {
  flex: 0 0 auto;
}

.row-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.row-tag {
  font: 400 0.8125rem/1.4 var(--mono);
  color: var(--slate);
}

.row-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.875rem;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
  overflow-wrap: anywhere;
}

.row-meta code {
  font-size: 0.875rem;
  color: var(--ink);
}

.sep {
  margin: 0 0.2em;
  color: #68738a;
}

.items .hint {
  margin: 0;
  font-size: 0.8125rem;
}

.items > li.current {
  box-shadow: inset 3px 0 0 var(--cobalt);
}

.items > li.current .row-title {
  color: var(--cobalt);
}

.devices-all {
  margin: 0;
}

/* Release notes (contract rev 31, "Tools"): plain text, always escaped, its line breaks kept. */
.notes {
  margin: 0.4rem 0 0;
  font: 400 0.875rem/1.6 var(--sans);
  color: var(--ink-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

textarea {
  min-height: 8rem;
  resize: vertical;
  font: 400 0.9375rem/1.5 var(--sans);
}

/* A tool's history on /account/tools and a release on the admin pages: closed until clicked, no script. */
details.history {
  margin-top: 0.6rem;
}

details.history > summary {
  width: fit-content;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cobalt);
  cursor: pointer;
}

details.history > summary:hover {
  color: var(--cobalt-hi);
}

.history-entry {
  margin: 0.7rem 0 0;
  padding: 0.6rem 0 0;
  border-top: 1px solid var(--line-soft);
}

.history-entry:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.history-entry .row-meta {
  margin-top: 0;
}

/* A tool's download buttons, one per platform. */
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* A product's card on the purchases page: its purchases, then its keys, each a line. A key's line
   ends in its own action. */
.key-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  align-items: center;
  margin-top: 0.6rem;
}

.key-line form {
  margin: 0;
}

/* A link that is a card's main action (the download): the filled button, without its sheen. */
a.action {
  display: inline-block;
  padding: 0.55rem 1.05rem;
  font: 600 0.8125rem/1.2 var(--sans);
  letter-spacing: 0.005em;
  color: var(--paper);
  background: linear-gradient(180deg, var(--azure) 0%, var(--cobalt) 50%, var(--cobalt-hi) 100%);
  background-size: 100% 200%;
  background-position: 0 0;
  border: 1px solid #1b3da8;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(14, 30, 61, 0.2), 0 6px 14px -8px rgba(31, 69, 184, 0.6);
}

a.action:hover {
  color: var(--paper);
  background-size: 100% 200%;
  background-position: 0 100%;
  border-color: var(--cobalt-hi);
}

a.action:focus-visible {
  outline-offset: 3px;
  border-radius: 8px;
}

/* The one view of a full licence key. */
.key {
  display: block;
  margin: 0 0 1rem;
  padding: 1.1rem 1.25rem;
  font: 400 1.125rem/1.5 var(--mono);
  letter-spacing: 0.06em;
  color: var(--cobalt-hi);
  word-break: break-all;
  background: linear-gradient(180deg, #f6f8ff, #edf2ff);
  border: 1px solid rgba(31, 69, 184, 0.22);
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(14, 30, 61, 0.05);
  -webkit-user-select: all;
  user-select: all;
}

/* ---------- Admin: the same shell, denser ---------- */

.page-admin dl {
  max-width: 60rem;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

.page-admin dd {
  font-size: 0.9375rem;
}

dd.status-up::before,
dd.status-down::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  vertical-align: 0.08em;
  border-radius: 50%;
}

dd.status-up::before {
  background: var(--up);
}

dd.status-down {
  color: var(--down);
}

dd.status-down::before {
  background: var(--down);
}

.table-wrap {
  margin: 0 0 1.25rem;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

/* Narrower than this, a table scrolls sideways in its wrapper instead of breaking every id. */
table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  font: 400 0.8125rem/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

th {
  padding: 0.65rem 0.8rem;
  font: 500 0.75rem/1.3 var(--sans);
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
  color: var(--slate);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line-soft);
}

tbody tr:first-child td {
  border-top: 0;
}

tbody tr:hover {
  background: #f8faff;
}

td code {
  font-size: 0.9em;
  color: var(--ink-soft);
  word-break: break-all;
}

td a {
  background-size: 0% 1px, 0% 1px;
}

td a:hover {
  background-size: 100% 1px, 0% 1px;
}

td .hint {
  margin-top: 0.15rem;
  font-size: 0.75rem;
}

td form.inline {
  flex-wrap: nowrap;
}

form.inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0.6rem 0.2rem 0;
  vertical-align: middle;
}

form.inline input,
form.inline select {
  display: inline-block;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.8125rem;
  border-radius: 8px;
}

form.inline label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--slate);
}

form.inline input[type="checkbox"] {
  margin: 0 0.45rem 0 0;
}

td form.inline {
  margin: 0.15rem 0.4rem 0.15rem 0;
}

.page-admin .shell-main > form.inline {
  margin-bottom: 1rem;
}

.page-admin .shell-main > form.inline input {
  padding: 0.6rem 0.8rem;
  font-size: 0.875rem;
  border-radius: 10px;
}

.page-admin .shell-main > form.inline button {
  padding: 0.62rem 1.1rem;
}

/* Step-up: the prompt and the page, edged in amber. */
.step-up-note {
  padding: 0.55rem 0.85rem;
  color: #7a3c00;
  background: #fdf4ea;
  border-radius: 8px;
  box-shadow: inset 3px 0 0 var(--warn-edge);
}

.stepup {
  max-width: 34rem;
  padding: 1.6rem 1.6rem 1.6rem 1.85rem;
  background: linear-gradient(180deg, #fff6ea, var(--paper) 60%);
  border: 1px solid rgba(194, 106, 10, 0.38);
  border-radius: 14px;
  box-shadow: inset 4px 0 0 var(--warn-edge), var(--shadow-card);
}

.stepup > :last-child {
  margin-bottom: 0;
}

/* ---------- Narrow screens, 200% zoom, small frames ---------- */

@media (max-width: 47.99rem) {
  .shell,
  .page-admin .shell {
    display: block;
    min-height: 0;
    padding: 0 1rem;
  }

  .masthead {
    min-height: 3.25rem;
    padding: 0.6rem 1rem;
  }

  .sidenav {
    flex-flow: row wrap;
    gap: 0.4rem;
    padding: 1.1rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidenav::before {
    flex-basis: 100%;
    padding: 0 0 0.35rem;
  }

  .sidenav a {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    background: var(--paper);
    border-radius: 999px;
    box-shadow: 0 0 0 1px var(--line);
  }

  .sidenav a[aria-current="page"] {
    background: #eef2fd;
    box-shadow: 0 0 0 1px var(--cobalt);
  }

  .shell-main,
  .page-admin .shell-main {
    padding: 1.5rem 0 3rem;
  }

  /* The admin search and filter fields take the full width instead of their `size`. */
  .shell-main > form.inline {
    display: flex;
  }

  .shell-main > form.inline input {
    width: 100%;
  }

  .shell-main h1 {
    font-size: 1.625rem;
  }

  .items > li {
    align-items: flex-start;
  }

  dl {
    grid-template-columns: minmax(0, 1fr);
  }

  dt {
    padding: 0.8rem 1.25rem 0;
  }

  dd {
    padding: 0.15rem 1.25rem 0.8rem;
    border-top: 0;
  }

  .panel {
    padding: 1.25rem;
  }
}

@media (max-width: 30rem) {
  .auth {
    padding: 1rem 0 1.5rem;
  }

  .auth > .brand {
    margin-bottom: 1.1rem;
  }

  .card {
    width: calc(100% - 1.5rem);
    padding: 1.6rem 1.3rem 1.4rem;
    border-radius: 16px;
  }

  .card h1 {
    font-size: 1.5rem;
    margin-bottom: 1.1rem;
  }

  .card .links {
    margin-top: 1.2rem;
    padding-top: 1rem;
  }
}

@media (max-height: 36rem) {
  .auth {
    padding: 0.75rem 0 1rem;
  }

  .auth > .brand {
    margin-bottom: 0.9rem;
  }

  label {
    margin-bottom: 0.85rem;
  }
}

/* ---------- Motion: only when the reader has not asked for less ---------- */

@media (prefers-reduced-motion: no-preference) {
  @keyframes tfg-rise {
    from {
      opacity: 0;
      transform: translateY(14px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes tfg-fade {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes tfg-lift-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  .auth > .brand {
    animation: tfg-fade 0.6s var(--ease-out) both;
  }

  .card {
    animation: tfg-rise 0.75s var(--ease-out) 0.08s both;
  }

  .shell-main > * {
    animation: tfg-lift-in 0.5s var(--ease-out) both;
  }

  .shell-main > :nth-child(2) {
    animation-delay: 0.04s;
  }

  .shell-main > :nth-child(3) {
    animation-delay: 0.08s;
  }

  .shell-main > :nth-child(4) {
    animation-delay: 0.12s;
  }

  .shell-main > :nth-child(n + 5) {
    animation-delay: 0.16s;
  }

  a {
    transition: background-size 0.3s var(--ease-out), color 0.2s ease;
  }

  input,
  select {
    transition: border-color 0.2s ease, box-shadow 0.25s ease, background-color 0.2s ease;
  }

  button,
  a.action {
    transition: transform 0.2s var(--ease-out), box-shadow 0.25s ease, background-position 0.35s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  }

  button:hover {
    transform: translateY(-1px);
  }

  button:active {
    transform: translateY(0) scale(0.985);
    transition-duration: 0.08s;
  }

  button:hover::after {
    transform: translateX(120%);
    transition: transform 0.75s ease;
  }

  .sidenav a,
  .items > li,
  tbody tr {
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  }
}

@media (forced-colors: active) {
  .card,
  .panel,
  .items,
  .pill,
  .stepup,
  .table-wrap,
  .masthead {
    border: 1px solid CanvasText;
  }

  .card::before,
  button::after {
    display: none;
  }

  a {
    text-decoration: underline;
  }

  a.action {
    border: 1px solid LinkText;
  }

  .sidenav a[aria-current="page"] {
    outline: 2px solid Highlight;
  }
}
