:root {
  --bg: #f5f6f8; --panel: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --brand: #0f766e; --brand-weak: #e6f4f2; --warn: #b45309; --warn-weak: #fff7e6;
  --err: #b91c1c; --err-weak: #fdecec; --ok: #15803d; --ok-weak: #eaf7ee; --hot: #dc2626;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

header.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 52px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); white-space: nowrap; }
.brand span { color: var(--brand); }
nav.groups { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
nav.groups a { padding: 6px 14px; border-radius: 6px; color: var(--text); white-space: nowrap; font-weight: 600; }
nav.groups a.on { background: var(--brand); color: #fff; }
nav.groups a.on .badge { box-shadow: 0 0 0 2px #fff; }
nav.groups a:hover { text-decoration: none; background: var(--bg); }
nav.groups a.on:hover { background: var(--brand); }
.subnav { position: sticky; top: 52px; z-index: 9; display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.subnav nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.subnav nav a { padding: 10px 12px; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.subnav nav a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.subnav nav a:hover { text-decoration: none; color: var(--text); }
main.wide { max-width: 1520px; }
.me { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--muted); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.badge.hot { background: var(--hot); }
.badge.warn { background: var(--warn); }
.bell { position: relative; border: 0; background: none; font-size: 18px; cursor: pointer; padding: 4px; }
.bell .badge { position: absolute; top: -2px; right: -8px; }
.bell-panel { position: absolute; right: 16px; top: 50px; width: 360px; max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.bell-panel a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.bell-panel a:hover { background: var(--bg); text-decoration: none; }
.bell-panel .empty { padding: 16px; color: var(--muted); }

main { max-width: 1180px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 4px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.stat { font-size: 26px; font-weight: 700; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
td.num, th.num { text-align: right; }
tr.unread td { font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table { border: 0; }
.kv th { width: 180px; background: none; }
.pre { white-space: pre-wrap; word-break: break-word; }

input[type=text], input[type=number], input[type=url], select, textarea {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
textarea { width: 100%; min-height: 140px; }
input[type=text].wide { width: 100%; }
label { cursor: pointer; }
.btn { display: inline-block; font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: #f3c2c2; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: var(--ok-weak); color: var(--ok); }
.flash.warn { background: var(--warn-weak); color: var(--warn); }
.flash.error { background: var(--err-weak); color: var(--err); }
.note { padding: 10px 14px; border-radius: 8px; background: var(--warn-weak); color: var(--warn); margin-bottom: 12px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); }
.pill.ok { background: var(--ok-weak); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.pill.err { background: var(--err-weak); color: var(--err); border-color: transparent; }
.pill.run { background: var(--brand-weak); color: var(--brand); border-color: transparent; }

.log { background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 12px; max-height: 360px; overflow: auto;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.log .warn { color: #fbbf24; } .log .error { color: #f87171; } .log .ok { color: #4ade80; } .log .debug { color: #64748b; }
.approve { border: 2px solid var(--brand); }
.shot { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; }
.shot-box { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.copy { cursor: pointer; }
.bar { height: 12px; background: var(--brand); border-radius: 3px; }
.pager { margin-top: 12px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { width: 340px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--hot);
  border-radius: 8px; padding: 12px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.15); animation: in .25s ease-out; }
.toast.warn { border-left-color: var(--warn); }
.toast b { display: block; margin-bottom: 2px; }
.toast a { color: var(--text); }
@keyframes in { from { transform: translateY(10px); opacity: 0; } }

.login { max-width: 380px; margin: 12vh auto; text-align: center; }
@media (max-width: 720px) {
  header.top { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  nav.groups { order: 3; width: 100%; }
  .subnav { top: 0; position: static; padding: 0 12px; flex-wrap: wrap; }
  main { padding: 12px; }
  .bell-panel { left: 12px; right: 12px; width: auto; }
}
