:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #161b22;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #1f7a6d;
  --accent-dark: #145a50;
  --danger: #b42318;
  --warning: #a15c00;
  --ok: #16703b;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.sidebar {
  background: #111827;
  color: #f9fafb;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  color: #f9fafb;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.brand small {
  display: block;
  color: #b7c0cf;
}

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

.sidebar nav a,
.sidebar-footer a {
  color: #d7dde8;
  border-radius: 6px;
  padding: 9px 10px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #1f2937;
  color: #ffffff;
  text-decoration: none;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 4px;
  color: #b7c0cf;
  overflow-wrap: anywhere;
}

.content {
  padding: 28px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  margin-bottom: 6px;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.page-header p,
.muted,
.empty {
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
}

section,
.metric-grid,
.filter-bar,
.login-panel {
  margin-bottom: 22px;
}

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

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

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

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

.filter-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 5px;
  font-weight: 600;
}

input,
select,
button,
.button-link {
  min-height: 38px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 8px 10px;
  color: var(--text);
  min-width: 0;
}

button,
.button-link {
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: #ffffff;
  padding: 8px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.action-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}

.action-form label {
  grid-column: 1 / -1;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.summary-list div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid #eef1f5;
  padding-bottom: 8px;
}

.summary-list dt {
  color: var(--muted);
  font-weight: 600;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef1f5;
  text-align: left;
  vertical-align: top;
}

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

td code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.number {
  text-align: right;
  white-space: nowrap;
}

.status,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #edf2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.status.running,
.status.active {
  background: #dcfae6;
  color: var(--ok);
}

.status.suspended,
.status.error,
.status.failed,
.status.pending_delete {
  background: #fee4e2;
  color: var(--danger);
}

.status.pending,
.status.pending_restart,
.status.pending_stop,
.status.pending_start,
.status.pending_deploy {
  background: #fff0d5;
  color: var(--warning);
}

.json-block {
  background: #101828;
  color: #eef4ff;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.flash {
  border-radius: 8px;
  padding: 10px 12px;
  background: #edf2f7;
}

.flash.error {
  background: #fee4e2;
  color: var(--danger);
}

.flash.success {
  background: #dcfae6;
  color: var(--ok);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.login-panel {
  max-width: 420px;
  padding: 24px;
}

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

  .sidebar {
    position: static;
  }

  .metric-grid,
  .split-layout,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
