:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #15171a;
  --muted: #69717d;
  --line: #dfe4ea;
  --accent: #0f8b7f;
  --accent-strong: #086f66;
  --warn: #b7791f;
  --danger: #c2413a;
  --ok: #168447;
  --shadow: 0 12px 34px rgba(18, 26, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: #111416;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e5e5e5;
  overflow: hidden;
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #9ca6b2;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 4px;
}

nav a {
  color: #d7dde5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

nav a.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
}

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

.eyebrow,
.muted,
small {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge,
.status {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f3f1;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.danger {
  background: #fdeceb;
  color: var(--danger);
}

.badge.ok {
  background: #e8f5ee;
  color: var(--ok);
}

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

.metric,
.panel,
.band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
  min-height: 92px;
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: var(--muted);
  margin-bottom: 10px;
}

.metric strong {
  font-size: 24px;
}

.band,
.panel {
  padding: 16px;
}

.compact-page {
  max-width: 860px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

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

.quick-grid > div {
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.quick-grid span,
.quick-grid strong {
  display: block;
}

.quick-grid strong {
  margin-top: 8px;
  font-size: 16px;
  word-break: break-word;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

td strong,
td small {
  display: block;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #2a3440;
  word-break: break-all;
}

meter {
  width: 84px;
  height: 8px;
  margin-right: 8px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

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

.form-grid.compact {
  margin-top: 14px;
}

.wallet-form {
  grid-template-columns: minmax(120px, 160px) minmax(180px, 1fr) minmax(110px, 130px) minmax(160px, 1fr);
  align-items: end;
  margin-bottom: 14px;
}

.inline-status {
  align-self: center;
  font-size: 12px;
}

.launch-field[hidden] {
  display: none;
}

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

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 127, 0.12);
}

.primary,
.secondary,
.ghost-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

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

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

.secondary {
  background: #edf3f3;
  color: var(--accent-strong);
  border-color: #cde2df;
}

.ghost-button {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

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

.full {
  width: 100%;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: #e8f3f1;
  color: var(--accent-strong);
}

.switch-row {
  margin-top: 14px;
  display: flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
}

.switch-row input {
  width: 18px;
  min-height: 18px;
}

.command-list {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
}

.command-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 4px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.command-row small {
  grid-column: 1 / -1;
}

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

.loading-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.flash {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  color: var(--ink);
  font-weight: 700;
}

.flash.ok {
  background: #e8f5ee;
  border-color: #c9e6d6;
  color: var(--ok);
}

.flash.warn {
  background: #fff7e8;
  border-color: #f0d8a7;
  color: var(--warn);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-brand {
  margin-bottom: 24px;
}

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

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

  .sidebar {
    position: static;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  nav a {
    text-align: center;
  }

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

@media (max-width: 620px) {
  .main {
    padding: 16px;
  }

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

  .metrics-grid,
  .form-grid,
  .segmented,
  nav {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
