/* Base layer, shell and components.
 *
 * The spec is written for Tailwind v4 + React. This app is server-rendered Jinja with no build
 * step, so the ladders are expressed as hand-written classes instead of utilities — same tokens,
 * same radius/type/spacing/motion ladders, same rules. No hex values live here; they are all in
 * tokens.css.
 */

/* ---------------------------------------------------------------- base */

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

html {
  background-color: var(--vx-bg);
}

body {
  margin: 0;
  background-color: var(--vx-bg);
  color: var(--vx-text);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial,
               sans-serif;
  font-size: 0.875rem;   /* 14px body. Everything else is stated. */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Columns of numbers must align and must not shimmer when they update. */
table, .tabular { font-variant-numeric: tabular-nums; }

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* Focus is ALWAYS visible and NEVER removed. */
:focus-visible { outline: 2px solid var(--vx-primary); outline-offset: 2px; }
::selection { background-color: var(--vx-accent-bg); color: var(--vx-accent-text); }

* { scrollbar-color: var(--vx-scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--vx-scroll-thumb);
  border-radius: 9999px;
  border: 2px solid var(--vx-scroll-border);
}
::-webkit-scrollbar-thumb:hover { background: var(--vx-scroll-thumb-hover); }

/* ------------------------------------------------------------- motion */

@keyframes vx-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes vx-rise {
  from { opacity: 0; transform: translate3d(0, 8px, 0) }
  to   { opacity: 1; transform: translate3d(0, 0, 0) }
}
@keyframes vx-drop {
  from { opacity: 0; transform: translate3d(0, -6px, 0) scale(0.97) }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1) }
}

.vx-fade { animation: vx-fade-in 0.24s ease-out both; }
.vx-rise { animation: vx-rise 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
.vx-drop { animation: vx-drop 0.16s cubic-bezier(0.22, 1, 0.36, 1) both; transform-origin: top right; }

/* Capped at 5 steps: past that the last item waits half a second for nothing. */
.vx-stagger > * { animation: vx-rise 0.38s cubic-bezier(0.22, 1, 0.36, 1) both; }
.vx-stagger > *:nth-child(1) { animation-delay: 0ms }
.vx-stagger > *:nth-child(2) { animation-delay: 45ms }
.vx-stagger > *:nth-child(3) { animation-delay: 90ms }
.vx-stagger > *:nth-child(4) { animation-delay: 135ms }
.vx-stagger > *:nth-child(5) { animation-delay: 180ms }
.vx-stagger > *:nth-child(n + 6) { animation-delay: 220ms }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* -------------------------------------------------------------- shell */

.app { min-height: 100vh; }

.header {
  position: sticky; top: 0; z-index: 50;
  height: 3.5rem;
  border-bottom: 1px solid var(--vx-border);
  background: var(--vx-nav-95);
  backdrop-filter: blur(8px);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  height: 3.5rem; padding: 0 1rem;
}
.header-right { display: flex; align-items: center; gap: 0.5rem; }

.brand { display: flex; align-items: center; gap: 0.625rem; font-weight: 600; }
.brand-mark {
  display: grid; place-items: center;
  width: 1.75rem; height: 1.75rem;
  border-radius: 0.5rem;
  background: var(--vx-primary); color: #fff;
  font-size: 0.75rem; font-weight: 600;
}
.brand-sub { color: var(--vx-muted-2); font-size: 0.75rem; font-weight: 400; }

.body-row { display: flex; align-items: flex-start; }

.sidebar {
  position: sticky; top: 3.5rem;
  height: calc(100dvh - 3.5rem);
  width: 15rem; flex-shrink: 0;
  border-right: 1px solid var(--vx-border);
  background: var(--vx-surface);
  display: flex; flex-direction: column; gap: 1.5rem;
  overflow-y: auto;
  padding: 0.75rem;
}

.nav-group { display: flex; flex-direction: column; }
.nav-eyebrow {
  padding: 0 0.75rem 0.5rem;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--vx-muted-2);
}
/* Items under a heading hang off a hairline rail, so a glance reads them as a set. */
.nav-items { margin-left: 0.75rem; border-left: 1px solid var(--vx-border); padding-left: 0.5rem; }
.nav-items.flush { margin-left: 0; border-left: 0; padding-left: 0; }

.nav-link {
  display: flex; align-items: center; gap: 0.625rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--vx-muted);
  transition: all 200ms;
}
.nav-link:hover { transform: translateX(2px); background: var(--vx-surface-2); color: var(--vx-text); }
.nav-link.active { background: var(--vx-accent-bg); font-weight: 500; color: var(--vx-accent-text); }
.nav-link .grow { flex: 1; min-width: 0; }
.nav-link svg { flex-shrink: 0; }

.main { min-width: 0; flex: 1; }
.container { margin: 0 auto; max-width: 72rem; padding: 1.5rem 1rem; }
@media (min-width: 640px) { .container { padding-left: 1.5rem; padding-right: 1.5rem; } }

/* --------------------------------------------------------- primitives */

.card {
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--vx-border) 70%, transparent);
  background: var(--vx-surface);
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 24px -16px rgba(0, 0, 0, 0.5);
}
.card.compact { padding: 1rem; }
.card.flush { padding: 0; }
.card-band { padding: 1rem 1.25rem; }
.card-band + .card-band { border-top: 1px solid color-mix(in srgb, var(--vx-border) 70%, transparent); }

.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 600; }
.page-header p { margin: 0.25rem 0 0; color: var(--vx-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  font: inherit; font-size: 0.875rem;
  cursor: pointer;
  transition: all 150ms;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { pointer-events: none; opacity: 0.5; transform: none; }
.btn.sm { padding: 0.375rem 0.625rem; gap: 0.375rem; }   /* same 14px type on purpose */

/* 14px + medium is what clears contrast on the primary fill. Do not shrink the label. */
.btn.primary { background: var(--vx-primary); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--vx-primary-hover); }
.btn.secondary { background: var(--vx-surface-2); color: var(--vx-text); border-color: var(--vx-border); }
.btn.secondary:hover { background: var(--vx-accent-bg); }
.btn.ghost { background: transparent; color: var(--vx-muted); }
.btn.ghost:hover { background: var(--vx-surface-2); color: var(--vx-text); }
.btn.danger { background: var(--vx-danger); color: #fff; font-weight: 500; }
.btn.danger:hover { opacity: 0.9; }
.btn.icon { padding: 0.5rem; border-radius: 0.5rem; }

.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field > label { font-size: 0.875rem; font-weight: 500; color: var(--vx-text); }
.field .hint { font-size: 0.75rem; color: var(--vx-muted); }
.field .err { font-size: 0.75rem; color: var(--vx-danger); }

/* Recessed field that rises to the card's own surface on focus. The ring only confirms it. */
input[type=text], input[type=password], select, textarea {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--vx-border);
  background: color-mix(in srgb, var(--vx-surface-2) 40%, transparent);
  padding: 0.625rem 0.875rem;
  font: inherit; font-size: 0.875rem;
  color: var(--vx-text);
  transition: border-color 150ms, background-color 150ms;
}
input::placeholder { color: var(--vx-muted-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--vx-primary);
  background: var(--vx-surface);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--vx-primary) 25%, transparent);
}
select {
  appearance: none; padding-right: 2.5rem;
  background-image: none;   /* the chevron is drawn, so it can follow the theme */
}
.select-wrap { position: relative; }
.select-wrap svg {
  pointer-events: none; position: absolute; right: 0.75rem; top: 50%;
  transform: translateY(-50%); color: var(--vx-muted);
}

/* ---- A form broken into steps ------------------------------------------------------
   Numbered bands rather than one wall of inputs. A creator record needs eight fields, and eight
   fields in a row reads as a form to survive rather than three questions to answer. */
.form-step { display: flex; gap: 0.875rem; align-items: flex-start; }
.step-mark {
  display: grid; place-items: center; flex-shrink: 0;
  width: 1.5rem; height: 1.5rem; margin-top: 0.0625rem;
  border-radius: 9999px;
  background: var(--vx-accent-bg); color: var(--vx-accent-text);
  border: 1px solid var(--vx-accent-border);
  font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.step-body { flex: 1; min-width: 0; }
.step-title { margin: 0 0 0.75rem; font-size: 0.875rem; font-weight: 500; }
.form-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: color-mix(in srgb, var(--vx-surface-2) 40%, transparent);
}

/* The head of whoever is being typed, inside the field itself. */
.input-face { position: relative; display: flex; align-items: center; }
.input-face .avatar {
  position: absolute; left: 0.625rem; width: 1.25rem; height: 1.25rem;
  border-radius: 0.25rem; pointer-events: none;
}
.input-face input { padding-left: 2.25rem; }

/* ---- Radio pills and cards ---------------------------------------------------------
   A real radio input, moved off screen rather than display:none — hiding it removes it from the
   tab order and from the accessibility tree, and then the group cannot be used from a keyboard
   at all. The label is what gets styled, and :checked drives it. */
.choice-input {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; margin: 0; pointer-events: none;
}
.choice-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice-pill {
  cursor: pointer; user-select: none;
  border-radius: 9999px; border: 1px solid var(--vx-border);
  background: color-mix(in srgb, var(--vx-surface-2) 40%, transparent);
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem; color: var(--vx-muted);
  transition: all 160ms;
}
.choice-pill:hover { color: var(--vx-text); border-color: var(--vx-muted-2); }
.choice-input:checked + .choice-pill {
  background: var(--vx-accent-bg); border-color: var(--vx-primary);
  color: var(--vx-accent-text); font-weight: 500;
}
/* An option that is not available at the current tier. Shown rather than hidden, so the reader
   learns the rule instead of wondering where the option went. */
.choice-pill.disabled {
  opacity: 0.4; cursor: not-allowed; text-decoration: line-through;
}
.choice-pill.disabled:hover { color: var(--vx-muted); border-color: var(--vx-border); }

.choice-grid { display: grid; gap: 0.625rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.choice-card {
  cursor: pointer; display: flex; flex-direction: column; gap: 0.1875rem;
  border-radius: 0.75rem; border: 1px solid var(--vx-border);
  background: color-mix(in srgb, var(--vx-surface-2) 40%, transparent);
  padding: 0.75rem 0.875rem;
  transition: all 160ms;
}
.choice-card:hover { border-color: var(--vx-muted-2); }
.choice-title { font-size: 0.875rem; font-weight: 500; }
.choice-sub { font-size: 0.75rem; color: var(--vx-muted); line-height: 1.4; }
.choice-input:checked + .choice-card {
  border-color: var(--vx-primary);
  background: var(--vx-accent-bg);
  box-shadow: inset 0 0 0 1px var(--vx-primary);
}
/* Keyboard focus has to land somewhere visible, since the input itself is off screen. */
.choice-input:focus-visible + .choice-pill,
.choice-input:focus-visible + .choice-card {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--vx-primary) 35%, transparent);
}

.alert {
  display: flex; gap: 0.5rem;
  border-radius: 0.75rem; border: 1px solid;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert svg { margin-top: 0.125rem; flex-shrink: 0; }
.alert.danger  { border-color: var(--vx-danger);  background: var(--vx-danger-bg);  color: var(--vx-danger); }
.alert.warning { border-color: var(--vx-warning); background: var(--vx-warning-bg); color: var(--vx-warning); }
.alert.success { border-color: var(--vx-success); background: var(--vx-success-bg); color: var(--vx-success); }
.alert.info    { border-color: var(--vx-accent-border); background: var(--vx-accent-bg); color: var(--vx-accent-text); }
.alert a { text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  border-radius: 0.375rem; border: 1px solid transparent;
  padding: 0.0625rem 0.375rem;
  font-size: 0.75rem; font-weight: 500;
  white-space: nowrap;
}
.badge.brand   { background: var(--vx-accent-bg); color: var(--vx-accent-text); border-color: var(--vx-accent-border); }
.badge.muted   { background: var(--vx-surface-2); color: var(--vx-muted); border-color: var(--vx-border); }
.badge.success { background: var(--vx-success-bg); color: var(--vx-success); border-color: color-mix(in srgb, var(--vx-success) 40%, transparent); }
.badge.warning { background: var(--vx-warning-bg); color: var(--vx-warning); border-color: color-mix(in srgb, var(--vx-warning) 40%, transparent); }
.badge.danger  { background: var(--vx-danger-bg); color: var(--vx-danger); border-color: color-mix(in srgb, var(--vx-danger) 40%, transparent); }

/* ------------------------------------------------------------ figures */

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

.eyebrow {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em;
  color: var(--vx-muted);
}
/* Figure first, label beneath — the number is the subject. */
.figure { margin-top: 0.5rem; font-size: 1.875rem; font-weight: 600; letter-spacing: -0.02em; }
.figure.small { font-size: 1.125rem; }
.figure-hint { margin-top: 0.25rem; font-size: 0.875rem; color: var(--vx-muted); }

.muted { color: var(--vx-muted); }
.muted-2 { color: var(--vx-muted-2); }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.8125rem; }
.stack { display: flex; flex-direction: column; gap: 1.5rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.row > .field { flex: 1; min-width: 10rem; }
.section-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; }

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

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr {
  border-bottom: 1px solid var(--vx-border);
  text-align: left;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.025em;
  color: var(--vx-muted);
}
th { padding: 0.5rem 0.75rem; font-weight: 500; }
td { padding: 0.625rem 0.75rem; border-bottom: 1px solid color-mix(in srgb, var(--vx-border) 50%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 150ms; }
tbody tr:hover { background: color-mix(in srgb, var(--vx-surface-2) 60%, transparent); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td .cell-actions { display: flex; gap: 0.375rem; justify-content: flex-end; flex-wrap: wrap; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 3rem 1.5rem; text-align: center;
}
.empty-state .title { font-weight: 500; }
.empty-state p { max-width: 24rem; margin: 0; font-size: 0.875rem; color: var(--vx-muted); }

.pager { display: flex; gap: 0.75rem; align-items: center; margin-top: 1rem; font-size: 0.875rem; }

/* -------------------------------------------------------- account menu */

.menu-wrap { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.375rem); z-index: 50;
  width: 14rem; overflow: hidden;
  border-radius: 0.75rem; border: 1px solid var(--vx-border);
  background: var(--vx-surface);
  box-shadow: 0 8px 28px -12px rgba(0, 0, 0, 0.55);
}
.menu-head { padding: 0.75rem 0.875rem; border-bottom: 1px solid var(--vx-border); }
.menu-item {
  display: flex; width: 100%; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  text-align: left; font-size: 0.875rem; color: var(--vx-muted);
  background: none; border: 0; cursor: pointer; font-family: inherit;
  transition: background-color 150ms, color 150ms;
}
.menu-item:hover { background: var(--vx-surface-2); color: var(--vx-text); }
.menu-item.danger { color: var(--vx-danger); }
.menu-item.danger:hover { background: var(--vx-surface-2); }
[hidden] { display: none !important; }

/* -------------------------------------------------------- centred page */

.centre {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 25rem; }
.auth-card .brand { justify-content: center; margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.125rem; text-align: center; }
.auth-card .sub { margin: 0.25rem 0 1.25rem; text-align: center; font-size: 0.875rem; color: var(--vx-muted); }
.auth-card .btn { width: 100%; }
.auth-card .foot { margin: 1rem 0 0; text-align: center; font-size: 0.75rem; color: var(--vx-muted-2); }

/* ---------------------------------------------------------- responsive */

@media (max-width: 1023px) {
  .sidebar {
    position: fixed; left: 0; top: 3.5rem; z-index: 40;
    width: 16rem; height: calc(100dvh - 3.5rem);
  }
  .sidebar[hidden] { display: none !important; }
  .scrim { position: fixed; inset: 3.5rem 0 0 0; z-index: 30; background: rgba(0, 0, 0, 0.5); }
}
@media (min-width: 1024px) {
  .nav-toggle, .scrim { display: none !important; }
  .sidebar { display: flex !important; }
}
@media (max-width: 640px) {
  .grid.cols-2 { grid-template-columns: 1fr; }
  .container { padding: 1rem; }
}

/* ------------------------------------------------------- segmented control */

.segmented {
  display: inline-flex; flex-shrink: 0;
  border-radius: 0.5rem; border: 1px solid var(--vx-border);
  background: var(--vx-surface-2);
  padding: 0.125rem;
}
.segmented a {
  border-radius: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  color: var(--vx-muted);
  transition: all 200ms;
}
.segmented a:hover { color: var(--vx-text); }
.segmented a.on {
  background: var(--vx-surface); font-weight: 500; color: var(--vx-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ------------------------------------------------------------- avatars */

.avatar {
  width: 1.5rem; height: 1.5rem; border-radius: 0.25rem;
  image-rendering: pixelated;      /* a 8px skin head upscaled must stay crisp, not blurry */
  background: var(--vx-surface-2);
  flex-shrink: 0;
}
.avatar.lg { width: 3rem; height: 3rem; border-radius: 0.5rem; }

.copy-row {
  display: flex; gap: 0.5rem; align-items: center;
  border-radius: 0.75rem; border: 1px solid var(--vx-accent-border);
  background: var(--vx-accent-bg);
  padding: 0.625rem 0.875rem;
}
.copy-row input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; padding: 0;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.8125rem;
  color: var(--vx-accent-text);
}
.copy-row input:focus-visible { box-shadow: none; background: transparent; }

.server-dot { width: .5rem; height: .5rem; border-radius: 9999px; flex-shrink: 0; }
.server-dot.up { background: var(--vx-success); }
.server-dot.down { background: var(--vx-danger); }

/* ------------------------------------------------------------- charts */

/* The chart draws itself at this element's real pixel width and re-draws on resize. It is NOT
   an SVG scaled with preserveAspectRatio="none" — that squashes the horizontal axis and drags
   the stroke width and every glyph with it, which is what made the first version look stretched
   and its type look broken. */
.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg text { font-family: inherit; }

.chart-tip {
  position: absolute; z-index: 10; pointer-events: none;
  display: flex; flex-direction: column; gap: 1px;
  border-radius: 0.75rem; border: 1px solid var(--vx-border);
  background: var(--vx-surface);
  padding: 0.5rem 0.625rem;
  box-shadow: 0 8px 28px -12px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}
.chart-tip .v { font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip .t { font-size: 0.6875rem; color: var(--vx-muted); }

/* The breakdown tooltip on a stacked chart: one row per kind that actually occurred. */
.chart-tip.wide { gap: 0.1875rem; min-width: 9rem; }
.chart-tip .k {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: 0.75rem; color: var(--vx-muted);
}
.chart-tip .k i { width: 0.5rem; height: 0.5rem; border-radius: 2px; flex-shrink: 0; }
.chart-tip .k b {
  margin-left: auto; padding-left: 0.75rem;
  font-weight: 600; color: var(--vx-text); font-variant-numeric: tabular-nums;
}
.chart-tip .k.total {
  margin-top: 0.125rem; padding-top: 0.25rem;
  border-top: 1px solid var(--vx-border);
}

.chart-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}

/* Legend for a stacked chart. Carries each kind's total, so it doubles as the breakdown when
   nothing is hovered — the reader should not have to point at the chart to learn the split. */
.legend { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.legend-key {
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-size: 0.75rem; color: var(--vx-muted);
}
.legend-key i { width: 0.5rem; height: 0.5rem; border-radius: 2px; }
.legend-key b {
  font-weight: 600; color: var(--vx-text); font-variant-numeric: tabular-nums;
}

.segmented button {
  border: 0; font: inherit; cursor: pointer; background: transparent;
  border-radius: 0.375rem; padding: 0.25rem 0.625rem;
  font-size: 0.75rem; color: var(--vx-muted);
  transition: all 200ms;
}
.segmented button:hover { color: var(--vx-text); }
.segmented button.on {
  background: var(--vx-surface); font-weight: 500; color: var(--vx-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* A figure that changed slides its new value in. Deliberately not a count-up: interpolating
   puts numbers on screen that were never real readings. */
@keyframes vx-figure-swap {
  from { opacity: 0; transform: translate3d(0, 6px, 0) }
  to   { opacity: 1; transform: translate3d(0, 0, 0) }
}
.figure-swap { animation: vx-figure-swap 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }

.srv-head { display: flex; align-items: center; gap: 0.5rem; }
.srv-head .srv-name { font-weight: 500; }
.srv-head .srv-state { margin-left: auto; }
.srv-spark { margin-top: 0.5rem; position: relative; }

/* Dragging across the plot would otherwise select the axis labels as if they were a paragraph.
   Scoped to the drawing — never to a control, which must keep its focus ring. */
.chart svg { user-select: none; -webkit-user-select: none; }
.chart svg:focus, .chart svg:focus-visible { outline: none; }

/* The crosshair and the tooltip glide between samples instead of teleporting. Short, because a
   cursor the eye has to wait for stops feeling like a cursor. */
.chart svg g { transition: opacity 120ms ease-out; }
.chart svg g line, .chart svg g circle {
  transition: cx 90ms ease-out, cy 90ms ease-out, x1 90ms ease-out, x2 90ms ease-out;
}
.chart-tip { transition: left 90ms ease-out, top 90ms ease-out, opacity 120ms ease-out; }

/* ------------------------------------------------------------- rosters */

.roster, .srv-players { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.srv-players { margin-top: 0.5rem; }
.who {
  display: inline-flex; align-items: center; gap: 0.375rem;
  border-radius: 0.375rem; border: 1px solid var(--vx-border);
  background: var(--vx-surface-2);
  padding: 0.125rem 0.5rem 0.125rem 0.25rem;
  font-size: 0.75rem;
}
.who .avatar { width: 1.125rem; height: 1.125rem; border-radius: 0.1875rem; }

textarea { resize: vertical; min-height: 4.5rem; font-family: inherit; }

/* A required field says so on the label, quietly. An asterisk needs a legend; a word does not. */
.req {
  margin-left: 0.375rem; font-size: 0.6875rem; font-weight: 400;
  color: var(--vx-muted-2); text-transform: uppercase; letter-spacing: 0.04em;
}

/* The row currently open in the editor above. */
tr.row-editing { background: var(--vx-accent-bg); }
tr.row-editing td:first-child { box-shadow: inset 2px 0 0 var(--vx-primary); }

/* A checkbox with a sentence next to it, aligned on the first line rather than the middle. */
.check { display: flex; gap: 0.625rem; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 0.1875rem; accent-color: var(--vx-primary); flex-shrink: 0; }
.check span { font-size: 0.8125rem; color: var(--vx-muted); }

/* Role ID fields: one per rank, so they need to wrap rather than stretch across the card. */
.role-grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}
