:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #64748b;
  --line: #dbe4ee;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --danger: #be123c;
  --shadow: 0 18px 55px rgba(20, 33, 61, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #101827;
  color: white;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #2dd4bf;
  color: #0f172a;
  font-weight: 900;
}

.brand small,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .brand small {
  color: #9fb2c7;
}

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

.sidebar a {
  padding: 11px 12px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
}

.sidebar a.active,
.sidebar a:hover {
  background: rgba(45, 212, 191, 0.14);
  color: white;
}

main {
  width: min(1440px, 100%);
  padding: 30px;
}

.topbar,
.panel-heading,
.activity {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.95;
}

h2 {
  margin-top: 4px;
  font-size: 1.12rem;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

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

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

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

.metrics article {
  padding: 18px;
}

.metrics span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  overflow: hidden;
}

.section-panel {
  margin-bottom: 18px;
}

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding: 18px;
}

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

.subheading h3 {
  margin: 0;
  font-size: 1rem;
}

.subheading span {
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.78rem;
  font-weight: 900;
}

.panel-heading,
.activity {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.activity {
  margin-top: 18px;
  border-bottom: 0;
}

.activity code {
  padding: 12px 14px;
  border-radius: 8px;
  background: #e6fffb;
  color: var(--accent-strong);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  outline: 0;
}

textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

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

#searchInput {
  max-width: 320px;
}

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

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

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

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

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
}

.status {
  display: inline-flex;
  min-width: 82px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: capitalize;
}

.status.online {
  background: #dcfce7;
  color: #166534;
}

.status.testing,
.status.pending,
.status.review,
.status.syncing,
.status.missing_keys {
  background: #fef3c7;
  color: var(--warn);
}

.status.offline,
.status.rejected,
.status.suspended,
.status.failed {
  background: #ffe4e6;
  color: var(--danger);
}

.status.approved,
.status.passed,
.status.verified {
  background: #dcfce7;
  color: #166534;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.78rem;
}

.form-actions {
  padding: 0 18px 18px;
}

.connection-summary {
  display: grid;
  gap: 10px;
  margin: 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.connection-summary div {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.settings-workspace {
  padding: 0;
}

.secondary {
  background: #e2e8f0;
  color: var(--ink);
}

.secondary:hover {
  background: #cbd5e1;
}

form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#userFormMessage,
#registerMessage,
#nodeFormMessage,
#benchmarkFormMessage,
#profileSettingsMessage,
#passwordSettingsMessage,
#connectionSettingsMessage {
  min-height: 22px;
  color: var(--accent-strong);
  font-weight: 800;
}

.public-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.node-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.node-card h3 {
  margin: 14px 0 6px;
}

.node-card p {
  color: var(--muted);
}

dl {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
  font-weight: 900;
  text-align: right;
  max-width: 62%;
  overflow-wrap: anywhere;
}


.link-button {
  display: block;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.link-button:hover {
  background: transparent;
  color: var(--accent-strong);
}

.selected-row {
  background: #ecfeff;
}

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

.detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.status.average {
  background: #e0f2fe;
  color: #075985;
}

.status.good {
  background: #dbeafe;
  color: #1d4ed8;
}

.status.excellent {
  background: #dcfce7;
  color: #166534;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
}

.modal-card {
  width: min(880px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.icon-button {
  min-height: 36px;
}

.benchmark-result {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}



.node-actions-cell {
  position: relative;
  width: 72px;
  text-align: right;
}

.kebab-button {
  width: 38px;
  min-width: 38px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
}

.kebab-button:hover {
  border-color: #99f6e4;
  background: #ecfeff;
  color: var(--accent-strong);
}

.node-action-menu {
  position: absolute;
  top: 40px;
  right: 16px;
  z-index: 12;
  display: none;
  min-width: 154px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.node-action-menu.is-open {
  display: grid;
  gap: 4px;
}

.node-action-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 36px;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
}

.node-action-menu button:hover {
  background: #f1f5f9;
  color: var(--accent-strong);
}

.node-action-menu .danger-action {
  color: var(--danger);
}

.node-action-menu .danger-action:hover {
  background: #fff1f2;
  color: var(--danger);
}

[data-page-panel="allNodes"] table {
  min-width: 980px;
}

[data-page-panel="allNodes"] td:nth-child(3) small,
[data-page-panel="allNodes"] td:nth-child(4) small,
[data-page-panel="allNodes"] td:nth-child(5) small {
  margin-top: 6px;
}

[data-page-panel="allNodes"] .panel-heading {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

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

  .intake-panel {
    grid-column: 1 / -1;
  }

  .node-detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

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

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

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

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

@media (max-width: 680px) {
  main {
    padding: 18px;
  }

  .topbar,
  .panel-heading,
  .activity {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .workspace,
  .form-grid,
  .node-detail-grid,
  .sidebar nav,
  .public-grid {
    grid-template-columns: 1fr;
  }

  #searchInput {
    max-width: none;
  }

  .actions {
    flex-direction: column;
  }
}

.is-hidden,
[hidden] {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #101827;
}

.auth-panel {
  width: min(420px, 100%);
}

.login-card {
  width: 100%;
  padding: 28px;
  border: 1px solid rgba(219, 228, 238, 0.18);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.login-brand {
  margin-bottom: 22px;
  color: var(--ink);
}

.login-card h1 {
  margin-bottom: 18px;
  font-size: 2.4rem;
}

.login-hint {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

#loginMessage,
#registerMessage {
  min-height: 22px;
  color: var(--danger);
  font-weight: 800;
}

.auth-switch {
  width: 100%;
}

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

#viewerBadge {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

@media (max-width: 680px) {
  .session-actions {
    justify-content: stretch;
  }

  .session-actions > * {
    width: 100%;
  }
}

.sidebar nav button {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
  background: transparent;
  color: #cbd5e1;
  font-weight: 750;
}

.sidebar nav button.active,
.sidebar nav button:hover {
  background: rgba(45, 212, 191, 0.14);
  color: white;
}

.page-section {
  display: block;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.overview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #f8fafc;
}

.overview-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.overview-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
}

.padded-heading {
  padding: 18px 18px 0;
}

.placeholder-panel {
  padding: 18px;
  color: var(--muted);
  font-weight: 750;
}

.admin-only[hidden] {
  display: none !important;
}



.registration-key-card,
.provider-node-list {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.registration-key-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.registration-key-card h3 {
  margin: 4px 0 0;
  font-size: 1.16rem;
}

.registration-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.registration-key-row code {
  display: block;
  min-height: 48px;
  padding: 13px 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 900;
}

.key-actions,
.registration-guide-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.icon-action {
  min-width: 72px;
  padding: 0 12px;
}

.registration-guide-row {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.provider-node-list {
  padding: 18px;
}

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

.provider-node-card,
.empty-node-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.provider-node-card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.provider-node-card-head strong,
.empty-node-card strong,
.empty-node-card small {
  display: block;
}

.provider-node-card-head small,
.empty-node-card small {
  margin-top: 4px;
  color: var(--muted);
}

.provider-node-card dl {
  margin-top: 14px;
}

.provider-node-card dd {
  max-width: 58%;
  overflow-wrap: anywhere;
}

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

  .provider-node-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .overview-grid,
  .registration-key-row,
  .provider-node-grid {
    grid-template-columns: 1fr;
  }

  .registration-guide-row {
    align-items: stretch;
  }

  .registration-guide-row button,
  .key-actions button {
    flex: 1;
  }
}


.api-key-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.api-key-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.api-key-card div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.api-key-card code {
  overflow-wrap: anywhere;
  color: var(--text);
}


/* unified dashboard layout */
.overview-grid {
  grid-template-columns: 1fr;
}

.dashboard-table-section {
  grid-column: 1 / -1;
  min-width: 0;
}

.dashboard-table-section .table-wrap {
  overflow: visible;
  border-top: 1px solid var(--line);
}


/* public node marketplace */
[data-page-panel="publicNodes"] .panel-heading {
  align-items: flex-start;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

[data-page-panel="publicNodes"] .panel-heading > div {
  max-width: 720px;
}

[data-page-panel="publicNodes"] .panel-heading h2 {
  font-size: 1.45rem;
}

[data-page-panel="publicNodes"] .panel-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
}

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

.public-empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  min-height: 180px;
  place-content: center;
  border: 1px dashed #b8c7d9;
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
}

.public-empty-state strong {
  font-size: 1.15rem;
}

.public-empty-state small {
  color: var(--muted);
  font-weight: 750;
}

.public-node-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(20, 33, 61, 0.08);
}

.public-node-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.public-node-head h3 {
  margin: 12px 0 5px;
  font-size: 1.18rem;
  overflow-wrap: anywhere;
}

.public-node-head p {
  color: var(--muted);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.public-node-head > strong {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 11px;
  background: #ecfeff;
  color: #155e75;
  font-size: 0.94rem;
  white-space: nowrap;
}

.endpoint-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #eef2ff;
}

.endpoint-box span {
  color: #3730a3;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.endpoint-box code {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.public-node-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
  margin-top: 0;
}

.public-node-details div {
  display: grid;
  gap: 3px;
  justify-content: stretch;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf2f7;
}

.public-node-details dt {
  font-size: 0.75rem;
  text-transform: uppercase;
}

.public-node-details dd {
  max-width: none;
  text-align: left;
  overflow-wrap: anywhere;
}

.public-node-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.public-node-actions button {
  width: 100%;
}

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

@media (max-width: 680px) {
  .public-node-head,
  .public-node-actions {
    grid-template-columns: 1fr;
  }

  .public-node-head {
    display: grid;
  }

  .public-node-head > strong {
    justify-self: start;
  }

  .public-node-details {
    grid-template-columns: 1fr;
  }
}
