:root {
  --bg: #f4f6f8; --card: #fff; --text: #1d2733; --muted: #66717d; --line: #dde3e9;
  --accent: #2f6fb3; --ok: #1f8a4c; --ng: #c53b32; --warn: #b7791f; --unk: #8a949e;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
header { background: #1d2733; color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header h1 { font-size: 17px; margin: 0; flex: 1 0 auto; white-space: nowrap; }
header .mode, header #updated { overflow-wrap: anywhere; }
header .mode { font-size: 12px; background: #b7791f; padding: 2px 8px; border-radius: 10px; }
header button { background: transparent; color: #fff; border: 1px solid #fff6; }
nav { display: flex; gap: 4px; padding: 8px 16px 0; flex-wrap: wrap; }
nav button { border-radius: 8px 8px 0 0; border: 1px solid var(--line); border-bottom: none; background: #e9edf1; }
nav button.on { background: var(--card); font-weight: bold; }
main { padding: 0 16px 100px; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 0 8px 8px 8px; padding: 16px; display: none; }
section.on { display: block; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h2:first-child { margin-top: 0; }
button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { background: var(--ng); color: #fff; border-color: var(--ng); }
button:disabled { opacity: .5; cursor: default; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: normal; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; color: #fff; font-size: 13px; white-space: nowrap; }
.up { background: var(--ok); } .down { background: var(--ng); } .unknown { background: var(--unk); }
.muted { color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.spark { display: flex; align-items: flex-end; gap: 1px; height: 32px; margin-top: 6px; }
.spark i { flex: 1; background: #9cc3e8; min-height: 2px; }
.spark i.ng { background: var(--ng); height: 32px !important; }
.ops { display: flex; flex-wrap: wrap; gap: 8px; }
.ops button { min-width: 150px; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
input, select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.notice { background: #fff8e6; border: 1px solid #f0d9a0; padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.err { color: var(--ng); }
#mic { position: fixed; right: 20px; bottom: 20px; width: 64px; height: 64px; border-radius: 50%; font-size: 28px; background: var(--accent); color: #fff; border: none; box-shadow: 0 2px 8px #0004; }
#mic.listening { background: var(--ng); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
#voicebox { position: fixed; right: 20px; bottom: 96px; max-width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: 0 2px 8px #0003; display: none; white-space: pre-wrap; font-size: 14px; }
dialog { border: none; border-radius: 10px; padding: 20px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 4px 20px #0005; }
dialog h3 { margin-top: 0; }
.code { font-size: 28px; letter-spacing: 6px; font-weight: bold; font-family: monospace; }
pre { white-space: pre-wrap; word-break: break-all; background: #f4f6f8; padding: 8px; border-radius: 6px; font-size: 12px; margin: 4px 0 0; }
.login { max-width: 360px; margin: 80px auto; background: #fff; padding: 24px; border-radius: 10px; border: 1px solid var(--line); }
.login input { width: 100%; margin-bottom: 10px; }
/* 環境（グループ）のカード */
.cards { grid-template-columns: repeat(auto-fill, minmax(min(470px, 100%), 1fr)); }
.card.group table.rows { width: 100%; border-collapse: collapse; }
.card.group table.rows td { padding: 4px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.card.group { overflow-x: auto; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--unk); vertical-align: middle; }
.dot.up { background: var(--ok); } .dot.down { background: var(--ng); }
.badge.warn { background: var(--warn); }
.spark.small { height: 16px; margin: 0; width: 70px; }
.spark.small i.ng { height: 16px !important; }
.restart { margin-top: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.restart.ok { background: #e7f5ec; color: #1f6b3d; }
.restart.ng { background: #fdecea; color: #a1281f; }
.restart.checking { background: #fff8e6; color: #7a5a12; }
#voicebox.ng { border-color: var(--ng); }
@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr; }
  .card.group table.rows td.opt { display: none; }
}
