:root {
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-mono: "Azeret Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --canvas: #0c1014;
  --ink: #e8eef2;
  --muted: #8b9aa6;
  --dim: #667682;
  --accent: #e8eef2;
  --accent-deep: #c5d4dc;
  --accent-ink: #0c1014;
  --accent-wash: rgba(255, 255, 255, 0.12);
  --steel: rgba(186, 204, 214, 0.16);
  --hairline: rgba(255, 255, 255, 0.14);
  --hairline-strong: rgba(255, 255, 255, 0.18);
  --frost: rgba(12, 16, 20, 0.32);
  --frost-hover: rgba(12, 16, 20, 0.24);
  --frost-slot: rgba(12, 16, 20, 0.28);
  --frost-accent: rgba(255, 255, 255, 0.42);
  --frost-accent-hover: rgba(255, 255, 255, 0.34);
  --frost-solid: #171d23;
  --frost-blur: 26px;
  --frost-blur-sm: 20px;
  --frost-sat: 180%;
  --frost-sat-hover: 198%;
  --frost-filter: blur(26px) saturate(180%);
  --frost-filter-sm: blur(20px) saturate(180%);
  --frost-filter-hover: blur(26px) saturate(198%);
  --frost-filter-sm-hover: blur(20px) saturate(198%);
  --frost-edge: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --frost-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  --rail: 212px;
  --r-plate: 16px;
  --r-control: 10px;
  --r-chip: 8px;
  --z-field: 0;
  --z-ui: 1;
}

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

html, body {
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

html, body { overflow-x: clip; }

::selection { background: rgba(255, 255, 255, 0.38); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(12, 16, 20, 0.7); }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.32);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.5); }

h1, h2, h3 {
  font-family: var(--font-sans);
  font-weight: 600;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-chip);
  font-size: 12px;
  font-weight: 600;
}
.skip:focus { top: 12px; }

.ops-field-clip {
  position: fixed;
  inset: 0;
  z-index: var(--z-field);
  overflow: hidden;
  pointer-events: none;
  background: var(--canvas);
}

.ops-field {
  position: absolute;
  display: block;
  pointer-events: none;
  background: var(--canvas);
}

.ops-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(12, 16, 20, 0.94) 0%, transparent 8%, transparent 92%, rgba(12, 16, 20, 0.94) 100%),
    linear-gradient(180deg, rgba(12, 16, 20, 0.9) 0%, transparent 10%, transparent 90%, rgba(12, 16, 20, 0.9) 100%),
    radial-gradient(ellipse 88% 72% at 50% 42%, transparent 58%, rgba(12, 16, 20, 0.32) 100%);
}

.ops-ui {
  position: relative;
  z-index: var(--z-ui);
}

.gate, .app { position: relative; }

.plate,
.rail,
.user-card,
.chip,
.back,
#sign-out,
.live-chip,
.field input,
.field textarea,
.gate-card button[type="submit"],
.rail-item.is-active {
  -webkit-backdrop-filter: var(--frost-filter);
  backdrop-filter: var(--frost-filter);
}

.chip,
.back,
#sign-out,
.live-chip,
.field input,
.field textarea,
.relay-btn,
.relay-switch,
.notify-check input {
  -webkit-backdrop-filter: var(--frost-filter-sm);
  backdrop-filter: var(--frost-filter-sm);
}

.plate,
.user-card,
.chip,
.back,
#sign-out,
.live-chip {
  position: relative;
  background: var(--frost);
  border: 1px solid var(--hairline);
  box-shadow: var(--frost-edge);
}

.rail {
  position: relative;
  background: var(--frost);
  box-shadow: var(--frost-edge);
}

.plate::after,
.rail::after,
.user-card::after,
.chip::after,
.back::after,
#sign-out::after,
.live-chip::after,
.gate-card button[type="submit"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: var(--frost-grain);
  background-size: 140px 140px;
}

.plate { border-radius: var(--r-plate); }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.45); }
}

@keyframes skel-sweep {
  to { transform: translateX(120%); }
}

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.gate-card {
  width: min(100%, 400px);
  padding: 32px 28px 26px;
  animation: fade-in 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.gate-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.gate-card h1 {
  margin: 10px 0 8px;
  font-size: 34px;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.gate-copy {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 24px;
  max-width: 36ch;
}
.gate-copy .mono { font-size: 12px; color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-row { position: relative; }

.field input {
  width: 100%;
  height: 42px;
  padding: 0 72px 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--frost-slot);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  box-shadow: var(--frost-edge);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, backdrop-filter 160ms ease, -webkit-backdrop-filter 160ms ease;
}
.field input:hover {
  border-color: var(--hairline-strong);
  background: var(--frost-hover);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}
.field input:focus {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(12, 16, 20, 0.3);
  box-shadow: var(--frost-edge), 0 0 0 3px rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}

.field textarea {
  width: 100%;
  min-height: 108px;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--frost-slot);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  outline: none;
  resize: vertical;
  box-shadow: var(--frost-edge);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, backdrop-filter 160ms ease, -webkit-backdrop-filter 160ms ease;
}
.field textarea:hover {
  border-color: var(--hairline-strong);
  background: var(--frost-hover);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}
.field textarea:focus {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(12, 16, 20, 0.3);
  box-shadow: var(--frost-edge), 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.user-search {
  flex: 1 1 240px;
  max-width: 360px;
  margin-left: auto;
}
.user-search .field-row { width: 100%; }
.user-search input { padding-right: 14px; }

.reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.reveal:hover {
  color: var(--ink);
  background: var(--frost-hover);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}

.gate-error {
  min-height: 18px;
  margin: 10px 0 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #d4a8a8;
}

.gate-card button[type="submit"] {
  position: relative;
  width: 100%;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--r-control);
  background: var(--frost-accent);
  color: var(--accent-ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--frost-edge);
  transition: background 150ms ease, border-color 150ms ease, backdrop-filter 150ms ease, -webkit-backdrop-filter 150ms ease;
}
.gate-card button[type="submit"]:hover {
  background: var(--frost-accent-hover);
  border-color: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}

.gate-card button[type="submit"]:focus-visible,
.back:focus-visible,
#sign-out:focus-visible,
.rail-item:focus-visible,
.user-card:focus-visible,
.reveal:focus-visible,
.eye:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.app {
  display: flex;
  min-height: 100dvh;
}

.rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hairline);
  border-radius: 0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04), var(--frost-edge);
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 6px;
}

.rail-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(186, 204, 214, 0.28);
  box-shadow: 0 0 0 6px rgba(186, 204, 214, 0.06);
  background:
    radial-gradient(circle at 50% 50%, var(--accent) 0 3px, transparent 3.5px);
}

.rail-word {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}

.rail-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 3px;
}

.rail-session { padding: 24px 20px 8px; }
.rail-count-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--dim);
}
.rail-count {
  margin-top: 2px;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.rail-nav { flex: 1; padding: 18px 12px 0; }
.rail-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, backdrop-filter 150ms ease, -webkit-backdrop-filter 150ms ease;
}
.rail-item:hover {
  color: var(--ink);
  background: var(--frost-hover);
  border-color: var(--hairline);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}
.rail-item.is-active {
  color: var(--ink);
  background: var(--accent-wash);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: var(--frost-edge);
}
.rail-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--dim);
}
.rail-item.is-active .rail-pip {
  background: var(--accent);
  box-shadow: none;
}

.rail-foot { padding: 14px 12px 16px; }
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-chip);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.live-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.live-chip.is-live::before {
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45);
  animation: pulse-ring 1.6s ease-in-out infinite;
}
.live-chip.is-off { color: var(--muted); }
.live-chip.is-off::before { background: var(--dim); animation: none; }

#sign-out {
  width: 100%;
  height: 36px;
  margin-top: 10px;
  border-radius: var(--r-control);
  color: var(--dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, backdrop-filter 150ms ease, -webkit-backdrop-filter 150ms ease;
}
#sign-out:hover {
  color: var(--ink);
  background: var(--frost-hover);
  border-color: var(--hairline-strong);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}

.stage {
  margin-left: var(--rail);
  flex: 1;
  padding: 36px 40px 48px;
  min-width: 0;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
}
.stage-head h1 {
  font-size: 36px;
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-wrap: balance;
}
#detail-id {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
#detail-id .detail-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.stage-sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  max-width: 46ch;
}
.detail-uid {
  margin-top: 8px;
  font-size: 11px;
  color: var(--dim);
  word-break: break-all;
}

.back {
  display: inline-flex;
  align-items: center;
  height: 32px;
  margin-bottom: 14px;
  padding: 0 12px;
  border-radius: var(--r-chip);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, backdrop-filter 150ms ease, -webkit-backdrop-filter 150ms ease;
}
.back:hover {
  color: var(--ink);
  background: var(--frost-hover);
  border-color: var(--hairline-strong);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-chip);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  z-index: 1;
}
.chip.on,
.chip.live {
  color: #3ecf8e;
  border-color: rgba(62, 207, 142, 0.32);
  background: rgba(62, 207, 142, 0.1);
}
.chip.off,
.chip.closed,
.chip.dead {
  color: #e24b4b;
  border-color: rgba(226, 75, 75, 0.28);
}
.chip.live,
.chip.dead {
  width: 10px;
  height: 10px;
  min-height: 0;
  padding: 0;
  justify-content: center;
  font-size: 0;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.user-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  text-align: left;
  color: inherit;
  font: inherit;
  border-radius: var(--r-plate);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, backdrop-filter 180ms ease, -webkit-backdrop-filter 180ms ease;
}
.user-card:hover {
  background: var(--frost-hover);
  border-color: var(--hairline-strong);
  -webkit-backdrop-filter: var(--frost-filter-hover);
  backdrop-filter: var(--frost-filter-hover);
}

.user-card .card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.user-card .name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.user-card .name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.25;
  color: #fff;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.host-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  line-height: 0;
  font-size: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.host-mark.is-fomo {
  border-color: rgba(139, 156, 255, 0.35);
  background: rgba(139, 156, 255, 0.1);
}
.host-mark.is-axiom {
  border-color: rgba(88, 214, 141, 0.35);
  background: rgba(88, 214, 141, 0.1);
}
.host-ico {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.host-vs {
  display: flex;
  align-items: center;
  gap: 10px;
}
.host-vs-sep {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}
.user-card .status,
.detail-sheet .status {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  display: block;
  font-size: 0;
  line-height: 0;
  color: transparent;
}
.user-card .status i,
.detail-sheet .status i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e24b4b;
  box-shadow: 0 0 0 3px rgba(226, 75, 75, 0.18);
}
.user-card .status.live i,
.detail-sheet .status.live i {
  background: #3ecf8e;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.22);
}
.user-card .status.dead i,
.detail-sheet .status.dead i {
  background: #e24b4b;
  box-shadow: 0 0 0 3px rgba(226, 75, 75, 0.18);
}

.user-card .page {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-card .event {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.user-card .balance {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.card-tags[hidden] { display: none !important; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.tag-row:empty { display: none; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--frost-slot);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-x {
  appearance: none;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.tag-x:hover { color: var(--ink); }

.detail-notes {
  padding: 16px 18px 18px;
  margin-bottom: 16px;
}
.detail-notes .keys-head { margin-bottom: 10px; }
.notes-block + .notes-block { margin-top: 16px; }
.detail-notes .field input { padding-right: 14px; }
.notes-actions {
  align-items: center;
  margin-top: 14px;
}
.notes-actions .notify-status {
  margin: 0;
}

.user-card.is-skel {
  pointer-events: none;
  min-height: 128px;
}
.user-card.is-skel .skel-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  transform: translateX(-100%);
  animation: skel-sweep 1.5s ease infinite;
  pointer-events: none;
  z-index: 3;
}

.empty[hidden],
#home-view[hidden],
#list-view[hidden],
#detail-view[hidden],
#settings-view[hidden],
.gate[hidden],
.app[hidden] {
  display: none !important;
}

.seg {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--frost);
  border: 1px solid var(--hairline);
  box-shadow: var(--frost-edge);
  flex: 0 0 auto;
}
.seg-btn {
  appearance: none;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active {
  background: var(--accent-wash);
  color: var(--ink);
}
.seg-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dash-kpi {
  padding: 16px 16px 14px;
}
.dash-kpi .l {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.dash-kpi .v {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.dash-kpi .s {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.dash-kpi.is-live .v { color: #3ecf8e; }
.dash-kpi.is-hidden .v { color: #c5d4dc; }
.dash-kpi.is-closed .v { color: #e24b4b; }

.dash-card {
  padding: 20px 18px 16px;
  margin-bottom: 16px;
}
.dash-card h2 {
  margin: 6px 0 0;
  font-size: 20px;
  letter-spacing: -0.035em;
}
.dash-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.dash-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dash-legend .host-mark {
  width: 20px;
  height: 20px;
}
.dash-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.dash-chart {
  display: block;
  width: 100%;
  height: 220px;
}
.dash-chart--bars { height: 200px; }

.dash-split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-split .dash-card { margin-bottom: 0; }

.dash-hosts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-host {
  padding: 20px 18px 16px;
}
.dash-host-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.dash-host h2 {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 0;
  line-height: 0;
}
.dash-host .host-mark {
  width: 24px;
  height: 24px;
}
.dash-host .host-ico {
  width: 20px;
  height: 20px;
}
.dash-host .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-host .metric { padding: 12px 14px 10px; }
.dash-host .metric:nth-child(3n) { border-right: 0; }
.dash-host .metric:nth-child(n+4) { border-top: 1px solid var(--hairline); }
.dash-empty {
  padding: 28px 18px;
  color: var(--muted);
  font-size: 14px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 36px 32px;
  max-width: 420px;
}
.empty-mark {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 50%;
  border: 1px solid rgba(186, 204, 214, 0.28);
  box-shadow: 0 0 0 7px rgba(186, 204, 214, 0.06);
  background: radial-gradient(circle at 50% 50%, var(--accent) 0 3px, transparent 3.5px);
}
.empty-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.empty-copy {
  font-size: 14px;
  color: var(--muted);
  max-width: 36ch;
  line-height: 1.5;
}

.detail-sheet { padding: 0 0 10px; margin-bottom: 16px; }
.detail-sheet.detail-notes {
  padding: 16px 18px 18px;
}

.detail-sheet-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 16px 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.metric {
  padding: 16px 18px 14px;
  border-right: 1px solid var(--hairline);
  background: transparent;
}
.metric:last-child { border-right: 0; }
.metric .l,
.page-row .l,
.keys-head,
.key-row .l {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 8px;
}
.metric .v {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.page-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 12px 18px;
  border-top: 1px solid var(--hairline);
}
.page-row .l { margin-bottom: 0; }
.page-row .v {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.keys {
  border-top: 1px solid var(--hairline);
  padding: 4px 0 4px;
}
.keys-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 2px;
}
.keys-head {
  margin: 0;
  padding: 0;
}
.eye {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-chip);
  background: var(--frost);
  color: var(--dim);
  cursor: pointer;
  box-shadow: var(--frost-edge);
  -webkit-backdrop-filter: var(--frost-filter-sm);
  backdrop-filter: var(--frost-filter-sm);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, backdrop-filter 150ms ease, -webkit-backdrop-filter 150ms ease;
}
.eye svg {
  width: 15px;
  height: 15px;
  display: block;
}
.eye:hover {
  color: var(--ink);
  background: var(--frost-hover);
  border-color: var(--hairline-strong);
  -webkit-backdrop-filter: var(--frost-filter-sm-hover);
  backdrop-filter: var(--frost-filter-sm-hover);
}
.eye.is-on {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: rgba(255, 255, 255, 0.28);
}
.key-row {
  padding: 10px 18px 12px;
}
.key-row .v {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--frost-slot);
  box-shadow: var(--frost-edge);
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-all;
}
.key-row .v.is-empty {
  color: var(--dim);
}
.key-row.is-secret .v.is-masked {
  letter-spacing: 0.16em;
  user-select: none;
}

.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wallet-chip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--frost-slot);
  box-shadow: var(--frost-edge);
}
.wallet-chip .chain {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.wallet-chip .addr {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-all;
}
.wallet-chip .pk-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.wallet-chip .pk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.pk-actions,
.key-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.key-row-head {
  justify-content: space-between;
  margin-bottom: 8px;
}
.key-row-head .l {
  margin-bottom: 0;
}
.copy-btn {
  flex: 0 0 auto;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-chip);
  background: var(--frost);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--frost-edge);
  -webkit-backdrop-filter: var(--frost-filter-sm);
  backdrop-filter: var(--frost-filter-sm);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.copy-btn:hover {
  color: var(--ink);
  background: var(--frost-hover);
  border-color: var(--hairline-strong);
}
.copy-btn.is-copied {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: rgba(255, 255, 255, 0.28);
}
.copy-hit {
  cursor: pointer;
}
.copy-hit.is-copied {
  color: var(--ink);
}
.copy-fallback {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-chip);
  background: var(--frost);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  resize: none;
  overflow: auto;
}
.wallet-chip .eye-inline {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.wallet-chip .eye-inline svg {
  width: 13px;
  height: 13px;
}
.wallet-chip .pk {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  word-break: break-all;
}
.wallet-chip .pk.is-masked {
  letter-spacing: 0.16em;
  user-select: none;
}
.wallet-chip .pk.is-empty {
  color: var(--dim);
}

.keys-actions {
  padding: 0 18px 14px;
}
.recover-keys {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--r-control);
  background: var(--accent-wash);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.recover-keys:hover {
  background: rgba(255, 255, 255, 0.16);
}
.recover-keys:disabled {
  opacity: 0.55;
  cursor: wait;
}

.relay-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}
.relay-card {
  padding: 22px 20px 20px;
}
.relay-card .field { margin-top: 12px; }
.relay-card .field input { padding-right: 14px; }
.relay-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.relay-card h2 {
  margin: 8px 0 10px;
  font-size: 22px;
  letter-spacing: -0.04em;
}
.relay-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 16px;
}
.relay-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.relay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.relay-actions--foot {
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.relay-btn {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-control);
  background: var(--accent-wash);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.relay-btn:disabled { opacity: 0.45; cursor: default; }
.relay-btn.ghost {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.relay-actions--foot .relay-btn {
  flex: 1 1 auto;
  min-width: 0;
}
.notify-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.notify-check input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--frost-slot);
  box-shadow: var(--frost-edge);
  cursor: pointer;
}
.notify-check input:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px var(--accent-ink);
}
.notify-status {
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.notify-status.is-ok { color: var(--ink); }
.notify-status.is-bad { color: #e24b4b; }

.log { list-style: none; }
.log li {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
}
.log li:last-child { border-bottom: 0; }
.log .when {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.log .what {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.log .what small {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.log li.log-empty {
  display: block;
  padding: 28px 18px;
  border-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

@media (prefers-reduced-motion: reduce) {
  .gate-card { animation: none; }
  .live-chip.is-live::before { animation: none; }
  .user-card.is-skel .skel-shine { animation: none; }
  .user-card, .gate-card button[type="submit"], #sign-out, .back, .chip, .field input, .field textarea, .rail-item, .eye {
    transition: none;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .plate,
  .user-card,
  .rail,
  .chip,
  .back,
  #sign-out,
  .field input,
  .field textarea,
  .live-chip,
  .rail-item.is-active,
  .rail-item:hover,
  .eye {
    background: var(--frost-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .plate::after,
  .rail::after,
  .user-card::after,
  .chip::after,
  .back::after,
  #sign-out::after,
  .live-chip::after,
  .gate-card button[type="submit"]::after {
    display: none;
  }
  .gate-card button[type="submit"] {
    background: var(--accent);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .plate,
  .user-card,
  .rail,
  .chip,
  .back,
  #sign-out,
  .field input,
  .field textarea,
  .live-chip,
  .rail-item.is-active,
  .rail-item:hover,
  .eye {
    background: var(--frost-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .plate::after,
  .rail::after,
  .user-card::after,
  .chip::after,
  .back::after,
  #sign-out::after,
  .live-chip::after,
  .gate-card button[type="submit"]::after {
    display: none;
  }
  .gate-card button[type="submit"] {
    background: var(--accent);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (max-width: 1100px) {
  .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-split, .dash-hosts { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(3), .metric:nth-child(4) { border-top: 1px solid var(--hairline); }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-host .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-host .metric:nth-child(3n) { border-right: 1px solid var(--hairline); }
  .dash-host .metric:nth-child(2n) { border-right: 0; }
  .dash-host .metric:nth-child(n+3) { border-top: 1px solid var(--hairline); }
}

@media (max-width: 760px) {
  .rail {
    position: static;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }
  .rail-brand { padding: 14px 16px; }
  .rail-session { padding: 14px 8px; }
  .rail-count { font-size: 24px; }
  .rail-nav { flex: 1; padding: 8px; }
  .rail-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 12px;
    width: 100%;
  }
  #sign-out { width: auto; margin-top: 0; padding: 0 12px; }
  .app { flex-direction: column; }
  .stage { margin-left: 0; padding: 20px 16px 32px; }
  .stage-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .stage-head h1 { font-size: 28px; }
  .dash-card-head { flex-direction: column; }
  .dash-legend { justify-content: flex-start; }
  .log li { grid-template-columns: 1fr; gap: 4px; }
  .page-row { grid-template-columns: 1fr; gap: 4px; }
  .relay-grid { grid-template-columns: 1fr; }
}
