:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #d7dde8;
  --panel: #ffffff;
  --panel-soft: #f7f8fb;
  --nav: #111827;
  --nav-ink: #e6edf7;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #b42318;
  --green: #15803d;
  --shadow: 0 10px 30px rgb(15 23 42 / 8%);
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #eef2f7;
}

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

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

.sidebar {
  background: var(--nav);
  color: var(--nav-ink);
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 22px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 8px;
  background: #0f766e;
  font-weight: 800;
}

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

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

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

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 11px 12px;
  color: #c7d2e1;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgb(255 255 255 / 10%);
}

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

.dev-header,
.notice,
.panel,
.metric,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dev-header {
  padding: 14px;
}

.dev-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(130px, 0.7fr)) auto auto auto;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

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

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  color: #ffffff;
  background: var(--teal);
}

.ghost {
  color: var(--ink);
  background: #f3f6fa;
  border-color: var(--line);
}

.compact {
  min-height: 32px;
  padding: 5px 10px;
}

.notice {
  margin: 14px 0;
  padding: 10px 14px;
  color: var(--muted);
}

.notice.loading {
  color: var(--blue);
}

.view {
  display: grid;
  gap: 16px;
}

.nested-view {
  margin-top: 4px;
}

.view-heading h1,
.view-heading p,
.panel h2 {
  margin: 0;
}

.view-heading {
  display: grid;
  gap: 4px;
}

.action-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.view-heading h1 {
  font-size: 26px;
}

.view-heading p,
.muted {
  color: var(--muted);
}

.compact-heading h1 {
  font-size: 20px;
}

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

.metric {
  padding: 16px;
  display: grid;
  gap: 7px;
}

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

.metric strong {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.split-view {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  align-items: start;
}

.wide-left {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 390px);
}

.panel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.form-panel {
  align-content: start;
}

.stack {
  display: grid;
  gap: 14px;
}

.state-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.state-text.error {
  color: var(--red);
}

.state-text.success {
  color: var(--green);
}

.state-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.definition-list {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.definition-list dt {
  color: var(--muted);
}

.definition-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.channel-list {
  display: grid;
  gap: 10px;
}

.channel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.channel-row strong,
.channel-row small {
  display: block;
}

.channel-row small {
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.row-badges,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inbox-view {
  grid-template-columns: minmax(280px, 0.55fr) minmax(0, 1fr);
}

.conversation-list,
.message-list,
.failure-list {
  display: grid;
  gap: 10px;
}

.conversation-row {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.conversation-row.active-conversation {
  border-color: var(--teal);
  background: #ecfdf5;
}

.message-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.message-row p {
  margin: 8px 0;
  overflow-wrap: anywhere;
}

.message-row small {
  color: var(--muted);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.message-meta strong {
  color: var(--ink);
}

.failure-row {
  box-shadow: none;
}

pre {
  max-width: 100%;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  color: #ffffff;
  background: var(--blue);
}

.badge.pending,
.badge.idle {
  background: var(--amber);
}

.badge.active,
.badge.healthy {
  background: var(--green);
}

.badge.disabled,
.badge.error {
  background: var(--red);
}

.badge.neutral {
  color: var(--ink);
  background: #e7edf5;
}

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

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

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

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

td {
  overflow-wrap: anywhere;
}

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

  .sidebar {
    position: static;
  }

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

  .nav-item {
    text-align: center;
  }

  .dev-form,
  .metrics,
  .split-view,
  .wide-left,
  .inbox-view,
  .action-heading {
    grid-template-columns: 1fr;
  }

  .channel-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 14px;
  }

  .sidebar {
    padding: 16px 12px;
  }

  .brand {
    padding-bottom: 12px;
  }

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

  .definition-list {
    grid-template-columns: 1fr;
  }
}
