:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #d8dce3;
  --text: #1d2430;
  --muted: #6b7480;
  --accent: #2563eb;
  --accent-weak: #e8effd;
  --danger: #c0392b;
  --danger-weak: #fdecea;
  --ok: #1e7f4f;
  --ok-weak: #e6f4ec;
  --warn: #a06400;
  --warn-weak: #fdf3e0;
  --radius: 4px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI",
    system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.55;
}

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

a:hover {
  text-decoration: underline;
}

code {
  font-family: "SFMono-Regular", "Consolas", "Menlo", monospace;
  background: #eceff3;
  border-radius: 3px;
  padding: 1px 4px;
}

/* ---- レイアウト ---- */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 180px;
  flex: 0 0 180px;
  background: #1f2937;
  color: #e5e7eb;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar .brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 16px 12px;
  color: #ffffff;
}

.sidebar a {
  display: block;
  padding: 7px 16px;
  color: #cbd5e1;
  border-left: 3px solid transparent;
}

.sidebar a:hover {
  background: #273244;
  color: #ffffff;
  text-decoration: none;
}

.sidebar a[aria-current="page"] {
  background: #273244;
  border-left-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.content {
  flex: 1 1 auto;
  padding: 18px 22px 48px;
  min-width: 0;
}

/* ---- 見出し・パネル ---- */

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

h1 {
  font-size: 17px;
  margin: 0;
}

h2 {
  font-size: 14px;
  margin: 0 0 8px;
}

.crumb {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.spacer {
  flex: 1 1 auto;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

/* ---- テーブル ---- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef1f5;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f7f9fc;
}

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

td.mono,
.mono {
  font-family: "SFMono-Regular", "Consolas", "Menlo", monospace;
  font-size: 12px;
  word-break: break-all;
}

.empty {
  color: var(--muted);
  padding: 10px 2px;
}

/* ---- フォーム ---- */

label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 3px;
}

.field {
  margin-bottom: 10px;
}

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field-row .field {
  flex: 1 1 180px;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 7px;
  font-size: 13px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  font-family: "SFMono-Regular", "Consolas", "Menlo", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
  min-height: 220px;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

input[type="text"]:focus,
textarea:focus {
  outline: 2px solid var(--accent-weak);
  border-color: var(--accent);
}

button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #f0f3f8;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.primary:hover:not(:disabled) {
  background: #1d4ed8;
}

button.danger {
  background: var(--danger-weak);
  border-color: #e8b4ae;
  color: var(--danger);
}

button.danger:hover:not(:disabled) {
  background: #f9d9d5;
}

/* ---- トグル ---- */

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.toggle:hover:not(:disabled) {
  background: none;
}

.toggle .track {
  width: 32px;
  height: 17px;
  border-radius: 9px;
  background: #c3c9d2;
  position: relative;
  transition: background 0.12s ease-in-out;
}

.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.12s ease-in-out;
}

.toggle.on .track {
  background: var(--ok);
}

.toggle.on .track::after {
  transform: translateX(15px);
}

/* ---- 通知 ---- */

.notice {
  border-radius: var(--radius);
  padding: 7px 10px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  white-space: pre-wrap;
}

.notice.info {
  background: var(--ok-weak);
  border-color: #b9dfc9;
  color: var(--ok);
}

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

/* ---- 状態バッジ ---- */

.status {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #eef1f5;
  color: var(--muted);
  white-space: nowrap;
}

.status.running {
  background: var(--accent-weak);
  border-color: #bcd2f8;
  color: var(--accent);
}

.status.succeeded {
  background: var(--ok-weak);
  border-color: #b9dfc9;
  color: var(--ok);
}

.status.stopped {
  background: var(--warn-weak);
  border-color: #ecd7a8;
  color: var(--warn);
}

.status.failed {
  background: var(--danger-weak);
  border-color: #e8b4ae;
  color: var(--danger);
}

/* ---- 未認証時の擬装 (素の nginx の 404 に寄せる) ---- */

.not-found {
  position: fixed;
  inset: 0;
  background: #fff;
  color: #000;
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
  padding: 8px;
}

.not-found h1 {
  text-align: center;
  font-size: 2em;
  font-weight: bold;
  margin: 0.67em 0;
}

.not-found hr {
  border: none;
  border-top: 1px inset #808080;
  margin: 0.5em 0;
}

.not-found p {
  text-align: center;
  margin: 0;
}

/* ---- 実行詳細 ---- */

.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
}

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

.meta dd {
  margin: 0;
}

pre.output {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "Consolas", "Menlo", monospace;
  font-size: 12px;
}
