:root {
  --ink: #1a2333;
  --muted: #5a6577;
  --faint: #8a94a6;
  --line: #e3e8f1;
  --bg: #f5f7fb;
  --card: #ffffff;
  --accent: #7c4dff;
  --grad: linear-gradient(90deg, #2f6bff, #7c4dff, #c86dd7, #f6588a, #ff9a3d);
  --shadow: 0 4px 18px rgba(30, 50, 90, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--grad) top / 100% 4px no-repeat, var(--bg);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--accent); }
button { font-family: inherit; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; }

/* ヘッダー */
.header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 14px; }
.logo {
  width: 54px; height: 54px; border-radius: 14px; flex: 0 0 54px;
  background: linear-gradient(135deg, #7c4dff, #f6588a 60%, #ff9a3d);
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  box-shadow: 0 4px 18px rgba(124, 77, 255, 0.3);
}
.title {
  font-size: 1.9rem; font-weight: 800; letter-spacing: 0.5px; line-height: 1.15;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.title .tag {
  display: inline-block; font-size: 0.66rem; font-weight: 700; color: var(--faint); -webkit-text-fill-color: var(--faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; margin-left: 10px; background: #fff; vertical-align: middle;
}
.subtitle { color: var(--faint); font-size: 0.85rem; margin-top: 2px; }
.status-badge {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  background: #e6f4ea; border-radius: 999px; padding: 6px 14px; white-space: nowrap; font-size: 0.82rem; font-weight: 600; color: #137333;
}
.status-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: #34a853; box-shadow: 0 0 8px #34a853; }
.account { font-size: 0.8rem; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.account button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--muted); cursor: pointer; font-size: 0.78rem; }

/* カード */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; }
.hero { position: relative; overflow: hidden; background: var(--grad) top / 100% 4px no-repeat, #fff; margin-bottom: 14px; }
.hero h3 { margin: 0 0 4px; font-size: 1.2rem; }
.hero p { margin: 0 0 12px; color: var(--muted); font-size: 0.86rem; }
.hero::after {
  content: ""; position: absolute; top: 0; left: 0; height: 100%; width: 38%;
  background: linear-gradient(100deg, transparent, rgba(124,77,255,0.06), transparent);
  animation: scan 3.2s linear infinite; pointer-events: none;
}
@keyframes scan { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
.stats { display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }
.stat { flex: 1 1 130px; border-radius: 14px; padding: 12px 14px; color: #fff; box-shadow: 0 4px 18px rgba(30,50,90,0.1); }
.stat:nth-child(1) { background: linear-gradient(135deg, #2f6bff, #55a4ff); }
.stat:nth-child(2) { background: linear-gradient(135deg, #7c4dff, #c86dd7); }
.stat:nth-child(3) { background: linear-gradient(135deg, #f6588a, #ff9a3d); }
.stat:nth-child(4) { background: linear-gradient(135deg, #ff9a3d, #ffc53d); }
.stat .v { font-size: 1.2rem; font-weight: 700; }
.stat .l { font-size: 0.72rem; opacity: 0.92; }

/* レイアウト */
.grid { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }
.side h4, .main h4 { margin: 0 0 8px; font-size: 0.95rem; }
label.lbl { display: block; font-size: 0.8rem; color: var(--muted); margin: 10px 0 4px; }
select, input[type="text"], input[type="password"], input[type="number"], input[type="date"] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 0.95rem; font-family: inherit; background: #fff; color: var(--ink);
}
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,77,255,0.15); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 11px 18px; font-size: 0.98rem; font-weight: 700; cursor: pointer; color: #fff;
  background: linear-gradient(90deg, #2f6bff, #7c4dff 70%, #c86dd7); box-shadow: 0 4px 14px rgba(124,77,255,0.3);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--line); box-shadow: none; font-weight: 600; padding: 7px 12px; font-size: 0.85rem; }
.btn.small { padding: 6px 12px; font-size: 0.82rem; border-radius: 9px; }
.hint { font-size: 0.78rem; color: var(--faint); margin-top: 6px; }

/* 進捗 */
.progress { display: none; align-items: center; gap: 12px; padding: 14px 16px; margin-top: 12px; border-radius: 12px; background: rgba(124,77,255,0.06); border: 1px solid rgba(124,77,255,0.2); font-size: 0.9rem; }
.progress.on { display: flex; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(124,77,255,0.25); border-top-color: var(--accent); animation: spin 0.9s linear infinite; flex: 0 0 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { display: none; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #fdecea; border: 1px solid #f5c2c0; color: #a32d2d; font-size: 0.9rem; white-space: pre-wrap; }
.err.on { display: block; }

/* 結果 */
.result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.result-title { border-left: 4px solid var(--accent); background: linear-gradient(90deg, rgba(124,77,255,0.09), transparent 80%); border-radius: 8px; padding: 7px 12px; font-weight: 700; flex: 1 1 auto; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.md { font-size: 0.95rem; }
.md h2 { font-size: 1.08rem; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.md h2:first-child { margin-top: 0; }
.md table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 0.88rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; white-space: nowrap; }
.md th { background: #f5f7fb; }
.md td:first-child { white-space: normal; min-width: 140px; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: 2px 0; }
.note { font-size: 0.78rem; color: var(--faint); margin-top: 10px; }

/* 履歴 */
.history { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.history li { padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 0.85rem; border: 1px solid transparent; }
.history li:hover { background: #f5f7fb; }
.history li.active { border-color: var(--accent); background: rgba(124,77,255,0.06); }
.history .d { font-size: 0.72rem; color: var(--faint); }
.empty { font-size: 0.82rem; color: var(--faint); }

/* ログイン */
.login { max-width: 460px; margin: 40px auto; text-align: center; }
.login h2 { margin: 0 0 6px; font-size: 1.25rem; }
.login p { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.login input { text-align: center; font-size: 1.1rem; letter-spacing: 1px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.75rem; font-weight: 600; background: #eef0f5; color: var(--muted); }
.chip.ok { background: #e6f4ea; color: #137333; }
.chip.ng { background: #fdecea; color: #a32d2d; }
.footer { text-align: center; font-size: 0.75rem; color: var(--faint); margin-top: 30px; }
