:root {
  color-scheme: light;
  --ink: #151712;
  --muted: #5d655b;
  --line: #d8ded2;
  --paper: #f4f7ef;
  --panel: #ffffff;
  --green: #0f8f73;
  --green-dark: #075f4e;
  --blue: #235fd6;
  --amber: #c97813;
  --red: #bd2f24;
  --shadow: 0 20px 70px rgba(23, 26, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 143, 115, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(35, 95, 214, 0.08), transparent 40%),
    var(--paper);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(21, 23, 18, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 23, 18, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

button:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

a {
  color: inherit;
}

.buttonLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.buttonLink:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.accent {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.danger {
  background: #fff;
  color: var(--red);
  border-color: rgba(189, 47, 36, 0.35);
}

.ghost {
  background: transparent;
}

.iconOnly {
  width: 40px;
  padding: 0;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(15, 143, 115, 0.22);
  border-color: var(--green);
}

label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 28px;
  height: 100vh;
  padding: 30px;
  background: rgba(255, 255, 255, 0.54);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-family: "Bahnschrift", "Aptos", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Bahnschrift", "Aptos", sans-serif;
  line-height: 1;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  max-width: 220px;
}

h2 {
  font-size: clamp(30px, 4vw, 52px);
}

h3 {
  font-size: 18px;
}

.tokenBox {
  display: grid;
  gap: 10px;
}

.loginShell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.loginPanel {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.loginPanel h1 {
  max-width: none;
}

.loginError {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.railMeta {
  align-self: end;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.railNav {
  display: grid;
  gap: 8px;
}

.railNav a {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.railNav a:hover,
.railNav a.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.statusDot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.statusDot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
}

.statusDot.online::before {
  background: var(--green);
}

.workspace {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
}

.topActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.userMetrics {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.metrics div {
  display: grid;
  gap: 10px;
  min-height: 110px;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.metrics div:last-child {
  border-right: 0;
}

.metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics strong {
  font-family: "Bahnschrift", "Aptos", sans-serif;
  font-size: clamp(24px, 3vw, 38px);
}

.metrics .mutedMetric strong {
  color: var(--muted);
  font-size: clamp(20px, 2.5vw, 30px);
}

.issuer,
.tableWrap,
.settingsPanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.issuer {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.issueForm {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) minmax(120px, 0.7fr) auto;
  gap: 14px;
  align-items: end;
}

.settingsPanel {
  padding: 18px;
}

.settingsForm {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 260px) auto;
  gap: 14px;
  align-items: end;
}

.settingsForm div {
  display: grid;
  gap: 5px;
}

.settingsForm span {
  color: var(--muted);
  font-size: 13px;
}

.secrets {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.secretHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.secretHeader div {
  display: grid;
  gap: 4px;
}

.secretHeader strong {
  font-family: "Bahnschrift", "Aptos", sans-serif;
}

.secretHeader span {
  color: var(--muted);
  font-size: 12px;
}

.secretRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbf6;
}

.secretRow code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.tableWrap {
  overflow: hidden;
}

.tableHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.tableHead input {
  max-width: 300px;
}

.tableScroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

tr:hover td {
  background: rgba(15, 143, 115, 0.05);
}

.keyMono {
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.pill.on {
  background: rgba(15, 143, 115, 0.12);
  color: var(--green-dark);
}

.pill.off {
  background: rgba(189, 47, 36, 0.1);
  color: var(--red);
}

.rowActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.emptyState {
  margin: 0;
  padding: 32px;
  color: var(--muted);
}

.poolGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding: 18px;
}

.poolCard {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcf8;
}

.poolCard header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.poolTitle {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.poolTitle strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.windowMeter {
  display: grid;
  gap: 8px;
}

.windowMeter span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0e9;
}

.bar i {
  display: block;
  width: var(--fill);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.poolFoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.docsHero {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.docsHero div,
.docCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.docsHero div {
  display: grid;
  gap: 9px;
  padding: 18px;
}

.docsHero span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.docsHero code,
.endpointList code {
  overflow-wrap: anywhere;
  color: var(--green-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.docsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.docCard {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: hidden;
  padding: 18px;
}

.docCard header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.docCard p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.docCard pre {
  overflow-x: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #10130f;
  color: #f3f6ed;
}

.docCard pre code {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

.endpointList {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.endpointList li {
  display: grid;
  gap: 5px;
}

.splitFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(21, 23, 18, 0.28);
  backdrop-filter: blur(4px);
}

.dialogBody {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.dialogBody header,
.dialogBody footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.dialogBody footer {
  grid-template-columns: auto 1fr auto auto;
}

.switchRow {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.switchRow input {
  width: 22px;
  min-height: 22px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  transform: translateY(20px);
  opacity: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .rail {
    position: relative;
    height: auto;
    grid-template-columns: 1fr minmax(240px, 360px);
    grid-template-rows: auto auto;
  }

  .railMeta {
    grid-column: 1 / -1;
  }

  .railNav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .metrics div:nth-child(even) {
    border-right: 0;
  }
}

@media (max-width: 680px) {
  .rail,
  .workspace {
    padding: 18px;
  }

  .rail {
    grid-template-columns: 1fr;
  }

  .topbar,
  .tableHead {
    align-items: stretch;
    flex-direction: column;
  }

  .issueForm {
    grid-template-columns: 1fr;
  }

  .settingsForm {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .docsHero,
  .docsGrid {
    grid-template-columns: 1fr;
  }

  .metrics div {
    border-right: 0;
  }
}
