:root {
  color-scheme: light;
  --ink: #15202b;
  --muted: #607080;
  --line: #d8e1e8;
  --panel: #ffffff;
  --page: #eef3f6;
  --blue: #2267b5;
  --green: #1d8a5b;
  --red: #c84646;
  --amber: #a86512;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: #0f1b24;
  color: #f6fafc;
  padding: 24px 18px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #6fd19a;
  color: #0f1b24;
  font-weight: 800;
}

.brand span,
.topbar p,
.panel p,
.metrics small,
.metrics span {
  color: var(--muted);
}

.brand span {
  display: block;
  color: #aab8c3;
  font-size: 13px;
}

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

nav a {
  border-radius: 8px;
  color: #c9d5df;
  padding: 11px 12px;
  font-size: 14px;
}

nav a.active,
nav a:hover {
  background: #1c2c38;
  color: #ffffff;
}

.shell {
  margin-left: 248px;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
}

.status-pill,
.admin-key-box {
  border: 1px solid var(--line);
  background: #ffffff;
}

.status-pill {
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 700;
  color: var(--amber);
}

.admin-key-box {
  display: flex;
  align-items: center;
  min-width: 320px;
  border-radius: 8px;
  padding: 6px;
}

.admin-key-box input,
.toolbar input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.admin-key-box button,
.toolbar button,
.row-action {
  border: 0;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 9px 12px;
}

.status-pill.ready {
  color: var(--green);
}

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

.metrics article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metrics article {
  padding: 16px;
}

.metrics strong {
  display: block;
  margin: 6px 0;
  font-size: 22px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 12px;
  margin-bottom: 12px;
}

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

.panel {
  min-width: 0;
  padding: 16px;
}

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

.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--blue);
  font-weight: 700;
}

.map-wrap {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe9ef;
}

.map-wrap img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  display: block;
}

.member-pin {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(21, 32, 43, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  padding: 7px 10px;
  box-shadow: 0 10px 26px rgba(21, 32, 43, 0.14);
  font-size: 13px;
}

.member-pin span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
}

.pin-one {
  left: 22%;
  top: 32%;
}

.pin-two {
  right: 19%;
  top: 22%;
}

.pin-two span {
  background: var(--blue);
}

.pin-three {
  left: 46%;
  bottom: 24%;
}

.pin-three span {
  background: var(--red);
}

.checks,
.module-list,
.list {
  display: grid;
  gap: 10px;
}

.check-row,
.module-row,
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.check-row small,
.module-row small,
.list-row small,
td small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar input {
  width: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

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

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

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

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

td {
  font-size: 14px;
}

.row-action {
  background: var(--green);
  min-width: 88px;
}

.row-action.danger {
  background: var(--red);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 16px;
}

.badge {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f5ee;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  background: #fff4df;
  color: var(--amber);
}

.setup-list {
  margin: 0;
  padding-left: 20px;
  color: #2d3a44;
}

.setup-list li {
  margin: 0 0 12px;
}

code {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f9fb;
  padding: 2px 5px;
}

.contract-page {
  background: var(--page);
}

.contract {
  width: min(920px, calc(100vw - 32px));
  margin: 32px auto;
}

.back-link {
  display: inline-block;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 18px;
}

.endpoint-table,
.socket-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-top: 18px;
}

.endpoint-table div {
  display: grid;
  grid-template-columns: 80px minmax(220px, 1fr) 1.2fr;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.endpoint-table div:last-child {
  border-bottom: 0;
}

.socket-card {
  padding: 16px;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .shell {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .grid,
  .lower {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .admin-key-box {
    min-width: 0;
    width: 100%;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar input {
    width: 100%;
  }

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

  .endpoint-table div {
    grid-template-columns: 1fr;
  }
}

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