:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dfe3e8;
  --text: #17202a;
  --muted: #657386;
  --accent: #146b62;
  --accent-weak: #dff2ee;
  --danger: #b42318;
  --danger-weak: #fde8e5;
  --warn: #9a6700;
  --warn-weak: #fff4d6;
  --ok: #067647;
  --ok-weak: #dff6e9;
  --shadow: 0 18px 42px rgba(29, 41, 57, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #101820;
  color: #fff;
  padding: 20px 14px;
}

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

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

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

.brand span {
  margin-top: 2px;
  color: #a8b3c1;
  font-size: 13px;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #d9e2ec;
  background: transparent;
  text-align: left;
  padding: 6px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
}

.main {
  min-width: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.api-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-width: 260px;
}

.api-control input {
  width: min(420px, 48vw);
}

input,
select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid var(--accent-weak);
  border-color: var(--accent);
}

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

.session-label {
  color: var(--muted);
  font-size: 14px;
}

.icon-button,
.text-button,
.primary-button,
.row-action {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.text-button,
.row-action {
  padding: 0 12px;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
}

.login-panel {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.login-card h1,
.workspace-head h1,
.details h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-card p,
.workspace-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.workspace {
  padding: 22px;
}

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

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

#pageLabel {
  min-width: 34px;
  text-align: center;
  color: var(--muted);
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.notice.error {
  color: var(--danger);
  border-color: #f2b8b5;
  background: var(--danger-weak);
}

.notice.success {
  color: var(--ok);
  border-color: #9fdab8;
  background: var(--ok-weak);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

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

th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfd;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef1f4;
  color: #364152;
  font-size: 12px;
  font-weight: 700;
}

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

.badge.warn {
  color: var(--warn);
  background: var(--warn-weak);
}

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

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  white-space: nowrap;
}

.row-action.danger {
  color: var(--danger);
  border-color: #f2b8b5;
}

.details {
  position: fixed;
  top: 0;
  right: 0;
  width: min(480px, 100vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  z-index: 10;
}

.details-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

#detailsKicker {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.details-body {
  overflow: auto;
  padding: 18px 20px 28px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 14px;
  margin-bottom: 18px;
}

.detail-grid dt {
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

.form-row {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

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

.hidden {
  display: none !important;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    border-right: 0;
    padding: 10px;
  }

  .brand {
    padding-bottom: 10px;
  }

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

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .nav-item span:last-child {
    display: none;
  }

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

  .api-control,
  .api-control input {
    width: 100%;
  }
}
