:root {
  color-scheme: dark;
  --background: #0b1120;
  --panel: #111827;
  --border: #263244;
  --text: #f3f4f6;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

button, input { font: inherit; }

button {
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #07111f;
  font-weight: 700;
  cursor: pointer;
}

button:disabled { opacity: .55; cursor: wait; }

.secondary {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.topbar h1 { margin: 0; font-size: 19px; }

.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions span { color: var(--muted); font-size: 12px; }

.hidden { display: none !important; }

.panel {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.login { max-width: 420px; margin: 64px auto; padding: 24px; }
.login h2 { margin: 0 0 20px; font-size: 18px; }
.login label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.form-row { display: flex; gap: 8px; }
.form-row input {
  min-width: 0;
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1220;
  color: var(--text);
}

output { display: block; min-height: 18px; margin-top: 6px; color: var(--muted); font-size: 12px; }
#login-error { color: var(--danger); }

.control {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.control strong, .control span { display: block; }
.control span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.control > div:last-child { text-align: right; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metrics article { padding: 16px; }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin: 7px 0 3px; font-size: 23px; }

.panel-head {
  min-height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head span { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 16px; border-bottom: 1px solid #1d2939; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
td:last-child { width: 100%; white-space: normal; color: var(--muted); }

.status { font-weight: 700; }
.status.success { color: var(--success); }
.status.needs_review { color: var(--warning); }
.status.failed { color: var(--danger); }

.command-list { margin: 0; padding: 0; list-style: none; }
.command-list li { padding: 12px 16px; border-bottom: 1px solid #1d2939; font-size: 13px; }
.command-list small { margin-left: 8px; color: var(--muted); }
.command-state { float: right; color: var(--accent); }
.empty { padding: 24px; color: var(--muted); text-align: center; font-size: 13px; }

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 1080px); }
  .topbar { min-height: 60px; }
  .metrics { grid-template-columns: 1fr; gap: 0; }
  .control { align-items: flex-start; }
  th, td { padding: 10px 12px; }
  .login { margin-top: 32px; }
}
