:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --surface-strong: #202420;
  --text: #171a17;
  --muted: #67706a;
  --border: #d9dfd8;
  --accent: #087f68;
  --accent-strong: #056653;
  --accent-soft: #d8eee8;
  --gold: #b9770e;
  --gold-soft: #f4e4c5;
  --danger: #b43a3a;
  --danger-soft: #f7dcdc;
  --input-bg: #ffffff;
  --table-head: #f8faf8;
  --row-surface: #fbfcfb;
  --sidebar-text: #f7faf7;
  --sidebar-muted: rgba(255, 255, 255, 0.64);
  --sidebar-border: rgba(255, 255, 255, 0.12);
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --shadow: 0 18px 45px rgba(21, 27, 23, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121611;
  --surface: #1a201b;
  --surface-soft: #232b25;
  --surface-strong: #0d100d;
  --text: #eef4ee;
  --muted: #a6b2aa;
  --border: #334039;
  --accent: #2fb996;
  --accent-strong: #67d2b5;
  --accent-soft: #14382f;
  --gold: #d8a247;
  --gold-soft: #3d301c;
  --danger: #f07f7f;
  --danger-soft: #3d2020;
  --input-bg: #121712;
  --table-head: #202820;
  --row-surface: #171d18;
  --sidebar-text: #eef4ee;
  --sidebar-muted: rgba(238, 244, 238, 0.68);
  --sidebar-border: rgba(238, 244, 238, 0.14);
  --sidebar-hover: rgba(238, 244, 238, 0.1);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface-strong);
  color: var(--sidebar-text);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #12a582 0 48%, transparent 48%),
    linear-gradient(315deg, #e0a32e 0 48%, transparent 48%),
    #f6faf6;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

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

.nav-button {
  width: 100%;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--sidebar-muted);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
}

.nav-button.is-active,
.nav-button:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

.sidebar-note {
  color: var(--sidebar-muted);
  font-size: 13px;
}

.sidebar-footer {
  display: grid;
  gap: 9px;
  margin-top: auto;
}

.access-role {
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 700;
}

.sidebar-action {
  width: 100%;
  border-color: var(--sidebar-border);
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.main {
  padding: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
  margin-bottom: 10px;
  letter-spacing: 0;
}

h3 {
  font-size: 17px;
  margin-bottom: 8px;
  letter-spacing: 0;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.button-row,
.toolbar,
.segmented,
.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.button {
  min-height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.button:hover {
  border-color: var(--accent);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.ghost {
  background: transparent;
}

.button.danger {
  color: var(--danger);
  border-color: #e2bbbb;
}

.button.is-selected {
  background: var(--surface-strong);
  color: var(--sidebar-text);
  border-color: var(--surface-strong);
}

.theme-toggle {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
  padding: 7px 10px;
  white-space: nowrap;
}

.grid {
  display: grid;
  gap: 12px;
}

.service-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.service-card {
  min-height: 180px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.service-card.ready {
  border-top: 4px solid var(--accent);
}

.service-card.planned {
  border-top: 4px solid var(--gold);
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status.planned {
  background: var(--gold-soft);
  color: #7a4c04;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.panel {
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

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

.field {
  display: grid;
  gap: 5px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 9px 11px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.wallet-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.wallet-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--row-surface);
}

.wallet-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.wallet-address {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  color: var(--muted);
}

.wallet-label {
  margin-bottom: 3px;
  font-weight: 700;
}

.viewer-note {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 12px;
}

.metric {
  padding: 12px;
  min-height: 84px;
}

.metric-value {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-head);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

th button {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font-weight: 700;
  text-align: left;
}

td {
  max-width: 340px;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.positive {
  color: var(--accent-strong);
  font-weight: 700;
}

.negative {
  color: var(--danger);
  font-weight: 700;
}

.hash {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  color: var(--accent-strong);
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.notice {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.notice.error {
  border-color: #e0b5b5;
  background: var(--danger-soft);
  color: #7f2323;
}

.settings {
  margin-top: 12px;
}

details.card {
  box-shadow: none;
}

summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
}

.details-body {
  border-top: 1px solid var(--border);
  padding: 14px;
}

.columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--row-surface);
}

.check label {
  cursor: pointer;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.custom-stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-soft);
}

.pill button {
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 0;
}

.loading {
  opacity: 0.72;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, transparent 0 68%, var(--accent-soft) 68% 82%, transparent 82%),
    var(--bg);
}

.login-panel {
  width: min(100%, 460px);
  display: grid;
  gap: 26px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.login-brand {
  color: var(--text);
}

.login-theme {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--text);
}

.login-submit {
  width: 100%;
  min-height: 48px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 12px;
    gap: 12px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  .nav {
    display: flex;
    gap: 8px;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    width: auto;
    flex: 0 0 auto;
    min-width: 132px;
    text-align: center;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 0;
  }

  .sidebar-action {
    width: auto;
    min-height: 38px;
    padding: 7px 12px;
  }

  .sidebar-note {
    display: none;
  }

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

@media (max-width: 640px) {
  body {
    font-size: 17px;
  }

  .main {
    padding: 12px;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  .button,
  .nav-button {
    white-space: normal;
  }

  .button-row,
  .segmented {
    width: 100%;
  }

  .button-row .button,
  .segmented .button {
    flex: 1 1 130px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .panel,
  .metric,
  .service-card {
    padding: 12px;
  }

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

  .metric-value {
    font-size: 20px;
    overflow-wrap: anywhere;
  }

  .field-row > * {
    flex: 1 1 160px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 19px;
  }

  .login-page {
    align-items: start;
    padding: 12px;
  }

  .login-panel {
    margin-top: 8vh;
    padding: 20px;
    gap: 22px;
  }

  .table-shell {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  table {
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  thead {
    display: none;
  }

  tbody tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  td {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(104px, 36%) minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    min-height: 44px;
    align-items: start;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }

  td + td {
    border-top: 1px solid var(--border);
  }
}

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

  .brand {
    font-size: 18px;
  }

  .theme-toggle {
    min-height: 36px;
    padding: 6px 8px;
  }

  td {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
